Learning Python Decorators by Example

Posted by Bob on Fri 20 October 2017 in Concepts • Tagged with decorators, design patterns, logging, caching, memoization, Flask, Django, properties, classmethod, staticmethod, lru_cache, mock.patch, contextmanager • 4 min read

Decorators are a sometimes overlooked feature and they might be hard to grasp for beginning Pythonistas. I agree with Aaron Maxwell that mastering them "can massively magnify the positive impact of the code you write", so make sure you add them to your toolkit if not done so already. In this article I explain what they do, why you want to use them and give some practical examples.


Continue reading

Twitter Digest 2017 Week 38

Posted by PyBites on Sun 24 September 2017 in Digest • Tagged with twitter, news, tips, python, Flask, Twilio, videos, learning, cheat sheets, Data Science, tutorials, Git, books, podcast, Machine Learning, security, AWS, logging • 2 min read

Every weekend we share a curated list of 15 cool things (mostly Python) that we found / tweeted throughout the week.


Continue reading

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 great learning exercise and a fun tool we use on our Slack now.


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

How we Automated our 100DaysOfCode Daily Tweet

Posted by Bob on Wed 05 April 2017 in Tools • Tagged with twitter, automation, tools, 100days, logging, tweepy, pytz • 4 min read

In this article I show you a way to automatically tweet your #100DaysOfCode Challenge progress. This saves you some extra time to focus on the coding. Isn't that all what matters?


Continue reading

Automate Tweeting: how to build a Twitterbot

Posted by Bob on Thu 29 December 2016 in Tools • Tagged with twitterapi, tweepy, feedparser, rss, logging, podcasts, virtualenv, pyvenv, venv, news, 3.6 • 3 min read

In this post I will show you how we automate part of our Twitter posting using feedparser and tweepy.


Continue reading

Learning from Python mistakes

Posted by Bob on Wed 28 December 2016 in Learning • Tagged with bestpractices, pep8, virtualenv, cleancode, logging, pytest, ebook, refactoring, gotchas • 2 min read

In this post I summarize some great lessons Mike Pirnat shared in his free ebook 'How to make mistakes in Python'


Continue reading