Deploying a Django App to PythonAnywhere

Posted by Bob on Sun 23 July 2017 in Django • Tagged with Django, 100DaysOfDjango, PythonAnywhere, Security, cloud, deployment • 3 min read

After Julian's great article on deploying a Flask app to Heroku, let's look at how we can deploy a Django app to PythonAnywhere (PA).


Continue reading

First Steps Learning Django: PyPlanet Article Sharer App

Posted by Bob on Mon 17 July 2017 in Django • Tagged with Django, 100DaysOfDjango, Planet Python, Twitter, tutorials, resources • 4 min read

In this post I share my first steps exploring Django. I created PyPlanet Article Sharer Django App to make it easier for us to share new Planet Python feed articles. It loads in new articles and generates tweet links. It lets us mark each entry as Shared or Skipped. I am sure this will facilitate our Twitter activity and News Digests. This is our first project of our 100 days of Django and our very first Django app overall!


Continue reading

From Script to Project part 2. - Packaging Your Code in Python

Posted by Bob on Sat 01 July 2017 in Learning • Tagged with packaging, modules, init, imports, refactoring, karma, Twitter • 3 min read

This week's article is about packaging your Python code. Sounds daunting? Actually it is pretty simple.


Continue reading

From Script to Project part 1. - Building a Karma Bot with Python and the Slack API

Posted by Bob on Sun 25 June 2017 in Tools • Tagged with Slack, karma, bot, API, picle, packaging, logging, Counter • 3 min read

We love Slack! But what if we can make it even cooler? Imagine: you are geeking out with your fellow developers on Slack and you want to give them credit. Or you can write "stupidsubject--" and it automagically shows "stupidsubject's karma decreased to -2". Enter Karma Bot. This is nothing new but building one myself was a good learning exercise and will kick-start our series on packaging your code.


Continue reading

Parsing Twitter Geo Data and Mocking API Calls by Example

Posted by Bob on Sat 17 June 2017 in Learning • Tagged with twitter, API, mock, geo, data, unittest, pickle, tweepy, testing, 100days • 2 min read

"Is this Bob or Julian?!" ... yeah tweeting from our shared @pybites Twitter account can be confusing! So I made a little script to parse the location of our tweets. Then I extended it to make it testable. I wrote a decorator to cache a couple of API outputs to be used with the unittest.mock patch decorator I learned about. A simple script turned into a good learning exercise.


Continue reading

Next Time I Will Use Pandas to Parse Html Tables

Posted by Bob on Thu 08 June 2017 in Concepts • Tagged with BeautifulSoup, regex, Pandas, parsing, data, data cleaning, energy, json, csv, html • 2 min read

Last week I did some html table parsing with BeautifulSoup and regex. It turns out there is an easier way to do this: Pandas.


Continue reading

OOP Beyond the Basics: Using Properties for Encapsulation, Computation and Refactoring

Posted by Bob on Wed 31 May 2017 in Concepts • Tagged with oop, property, decorators, encapsulation, computation, dunder, refactoring, pytest, 2vs3, getter, setter • 4 min read

In this article I share my learning of the property decorator coding a simple Account class. I think it's an unmissable tool in your (Python) OOP toolkit.


Continue reading

PyCon 2017 - Digest, Impressions, Reflection

Posted by Bob on Wed 24 May 2017 in Reviews • Tagged with conference, pycon, learning, community, networking, bokeh, parallel, mentoring, photos • 3 min read

PyCon 2017 was such a great conference, I made so many good connections, got to see many good things the community is working on. It was very inspiring. In this article a digest.


Continue reading

Building a Simple Birthday App with Flask-SQLAlchemy

Posted by Bob on Thu 11 May 2017 in Flask • Tagged with Flask-SQLAlchemy, SQLAlchemy, Flask, Facebook, birthday, calendar, icalendar, datetime • 3 min read

In this article I teach you how to get started with Flask-SQLAlchemy. I will set up a model, create the DB, retrieve birthdays from FB and import them into the DB. Lastly I will query the birthdays by date range.


Continue reading

How to Write a Simple Slack Bot to Monitor Your Brand on Twitter

Posted by Bob on Tue 25 April 2017 in Tools • Tagged with Twitter, Slack, Automation, monitoring, twython, TwythonStreamer, slacker, configparser, logging, brand, triggers • 3 min read

In this article I show you how to monitor Twitter and post alerts to a Slack channel. We built a nice tool to monitor whenever our domain gets mentioned on Twitter. The slacker and twython modules made this pretty easy. We also use configparser and logging.


Continue reading