Simple Flask app to compare the weather of 2 cities

Posted by Bob on Thu 20 April 2017 in Flask • Tagged with Flask, weather, API, OpenWeatherMap, learning, Heroku, pytz, deploy, Jinja, CSS • 3 min read

In this post I show you how to build a simple Flask app to compare the weather of 2 cities using the OpenWeatherMap API. Maybe this aids you in solving this week's challenge.


Continue reading

How to Write a Decorator with an Optional Argument?

Posted by Bob on Tue 11 April 2017 in Tips • Tagged with decorators, arguments, tricks, tips, cookbook • 3 min read

When playing with decorators (this week's challenge) I got stuck: how do you write a decorator that takes an optional argument? Python cookbook 3rd ed edition to the rescue. In this post how I failed my way to the right solution.


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

How to Build a Simple Slack Bot

Posted by Bob on Tue 04 April 2017 in Tools • Tagged with slack, API, bot, chatbot, deployment, shell, nohup, automation • 3 min read

I was playing with Slack's Real Time Messaging API the other day. Building a bot is pretty easy. In this article a simple example.


Continue reading

5 Vim Tricks to Speed up Your Python Development

Posted by Bob on Tue 28 March 2017 in Tools • Tagged with vim, tools, shortcuts, tricks, flake8, howdoi, conque, shell, virtualenv, nerdtree, pyperclip • 4 min read

In this article 5 Vim shortcuts to speed up your Python development.


Continue reading

Best Practices for Compatible Python 2 and 3 Code

Posted by Bob on Wed 22 March 2017 in Tools • Tagged with 2vs3, tox, six, python-modernize, porting, future, 2to3, coverage, futurize, caniusepython3, pip, Requests, Werkzeug • 3 min read

95% of most popular Python packages support Python 3. Maybe you are lucky and get to start fresh using Python 3. However as of last year Python 2.7 still reigns supreme in pip installs and at a lot of places 2.x is the only version you get to work in. I think writing Python 2 and 3 compatible code is an important skill, so lets check what it entails.


Continue reading

10 Tips to Get More out of Your Regexes

Posted by Bob on Wed 15 March 2017 in Tips • Tagged with regex, tips, parsing, regular expressions, findall • 5 min read

Regular expressions can be arcane, yet when used with care they can also be very powerful. In this post a couple of tips to get more out of your regexes when using Python's re module.


Continue reading

Module of the Week - Requests-cache for Repeated API Calls

Posted by Bob on Tue 14 March 2017 in Modules • Tagged with requests, cache, APIs, package • 2 min read

Today a quick article on a nice caching module when working with APIs: Requests-cache.


Continue reading

Simple API Part 2 - Building a Deep Work Logger with Flask, Slack and Google Docs

Posted by Bob on Fri 10 March 2017 in Flask • Tagged with Flask, Slack, Google docs, Heroku, APIs, pygsheets, git, commands, productivity, learning • 3 min read

After Simple API - part 1 a more practical app in this part 2 tutorial: a Deep Work logger integrating Google docs and Slack, including deployment of the app to Heroku.


Continue reading

Don't let mutability of compound objects fool you!

Posted by Bob on Tue 07 March 2017 in Concepts • Tagged with list, mutable, copy, deepcopy • 3 min read

In this article I explain the difference between shallow versus deep copy with a working example. It's an important concept when working with compound objects.


Continue reading