Tag Archives: Python

Python with Jinja2 and YAML

Introduction In this post we’ll see how to work with Jinja2 and YAML in your Python projects, to easily create and modify templates based on a YAML template. Essentially, we will use the configuration in the YAML file to replace the placeholders in the Jinja 2 template file. Jinja2 is widely used, examples include Ansible and also Flask… Read More »

Getting Started with PubNub and Sendgrid

Inspired by my first experience with PubNub I took it a small step further. While publishing some messages, I also wanted to send an email along using the Sendgrid service. Below is the code for this: from Pubnub import Pubnub import sendgrid import json publish_key = ” subscribe_key = ” channel = ‘wapptastic’ message = ‘Hello Wapptastic’ def… Read More »

Getting started with PubNub

[keen] Inspired by this blogpost from my good friend Antonio Mancuso, I decided to experiment also a little bit with PubSub. I know the technology from previous experiences but I have never been able to really take a deep dive into it. As Antonio gave an example based on Ruby, I decided to create an equivalent using Python.… Read More »

Send SMS via Twilio

While I was looking for a tool to send SMS text messages to my customers, I came across Twilio. It seemed pretty straightforward to integrate into my applications. So I decided to write a small script to test this service. This post describes some easy steps to get started with Twilio, more in particular, we write a small… Read More »

Webservice for system info: client part

Introduction In this post, we created a webservice that would allow us to store system information such as public and private IP address or the system name of your computer. In this post, we will develop a small client to use the server. GET /ip Retrieves the list of all systeminfo from the database GET /ip/:id Retrieves a… Read More »

Python Scraping

In this post, I will perform a little scraping exercise. Scraping is a software technique to automatically collect information from a webpage. Note: I have provided this example for illustrative purposes. It should be noted though scraping websites is not always allowed. What will we be doing? In this post, I will be building a very small program… Read More »

Flask Todo app with SQLAlchemy on OpenShift

Starting from the Hello World application In this post, we will create a Todo application based on Flask and SQLAlchemy and also immediately deploy it to Openshift. We begin by creating a simple Hello World app on Openshift to ensure everything works as expected. Flask_Todo_SQLAlchemy$ rhc app create todo python-2.7 postgresql-9.2 ——————- Domain: wymedia Cartridges: python-2.7, postgresql-9.2 Gear… Read More »

Flask Hello World on OpenShift

Introduction Building further on the very simple Hello World Flask app that I created, I wanted to see how difficult it was to do the same on OpenShift. Luckily, the Openshift team has prepared a template app for deploying Flask apps on Openshift. That makes life a bit easier. $ rhc app create hello python-2.7 Application Options ——————-… Read More »