Code Challenge 16 – Query Your Favorite API

By on 23 April 2017

There is nothing like a challenge to bring out the best in man. – Sean Connery

Hi Pythonistas, a new week, a new ‘bite’ of Python coding! This week we’ll let you play with Web APIs. They are fun to fiddle with and great for learning and building cool things.

We are eager to see what you come up with. If you want to share your work please do so via our new PR proc. Enjoy!

The Challenge

We keep it free-form so you can go wild on consuming your favorite service(s) / data.

Lack inspiration? Here are some ideas to get you started:

  • Make a Twitter digest or search for recommended books by your followers (we used the Twitter API before, see here, here, and here).

  • Make a Slack bot, for example to monitor Twitter (we will post an article this week how!). We have used the Slack API before, see here and here.

  • Make a notification email of series being aired this week, using TheTVDB and/or movies premieres using TheMovieDB API.

  • Pull a bunch of movie metadata using OMDb API. Maybe you want to use TMDb instead, as one of our community members commented in his PR for this challenge: TMDb seems more full featured and better supported.

  • Check reddit for useful (Python) threads using the their API

  • Pull your music playlists / metadata from Spotify API / Soundcloud API / YouTube API.

  • Republish your Instagram photos to your blog via their API.

  • Dump your friends’ birthdays in your own DB using the Facebook API. The FB API is huge, ranging from FB login to leveraging their powerful Graph API.

  • Do cool stuff with Google APIs: e.g. calendar, books, drive, Gmail, translate, Youtube, wow they really have a lot.

  • Send SMS with Twilio API, you probably have seen this awesome example some weeks ago? If not, check it out!

  • Query the weather via OpenWeatherMap (example here).


Still searching ideas? Check out this thread or programmableweb.

Using one API is cool, combining two is even more powerful (e.g. Twitter + Slack, Google + FB, or whatever combination). There are so many options here, we probably reserve another challenge to do more of this (if you like it).

If you are going to call an API repeatedly while developing you might want to consider a library like Requests-cache.

Getting ready

See our INSTALL doc how to fork our challenges repo to get cracking. We updated this doc with additional instructions how to submit your solution to our community branch (and end-of-the-week review) via a Pull Request (PR).

Archive

You can find all our code challenges so far here. If you have ideas for a future challenge or find any issues, please contact us or open a GH Issue.

Last but not least: there is no best solution, only learning more and better Python. Good luck!


Keep Calm and Code in Python!

— Bob and Julian

Want a career as a Python Developer but not sure where to start?