Introduction to the API Tutorial

Video games have always been a pricy hobby. With the next generation of consoles just being announced (or about to be) it makes sense to look at how pricing has changed on that front over time.

During the course of this tutorial you will get more familiar with some non-core Python libraries: requests for making interactions with HTTP much more easier, matplotlib for generating graphs and charts of various kinds and tablib for easily generating CSV datasets.


To this end we will write a simple script that fetches video game platform information from, combine that with CPI information made available by the Federal Reserve Bank of St. Louis to adapt the value of the US dollar over time (this calculation is not meant to be accurate but it provides a nice example of working with diverse datasets) and generate a bar chart and a CSV file displaying the price development.


  • Interacting with a public API
  • Warm introduction to REST by requesting information from an API
  • Command line arguments with Python
  • File Input/Output
  • Review of graph generation with matplotlib

What else you will be exposed to:

  • Python 2 versus Python 3’s print keywork/function
  • Logging
  • Use Python’s built-in argparse library
  • Validating data

Intro to APIs

API stands for Application Programming Interface, and provides a way for applications to talk to each other. Familiar applications include Twitter, Facebook, Yelp, Flickr, Instagram, etc. To interact with Twitter‘s API, you give input: authentication + 140 characters, and Twitter produces output: a tweet.

Applications can interact with each other too: If you have Instagram and Twitter paired, you upload a photo to Instagram, it communicates with Twitter over an API, and Twitter posts a link to the photo.

APIs receive calls – how you want to interact with the application, what parameters you will give that application, and the variables for those parameters. For instance, you make a call to, “Hey, I want you to give me a short link”, give the parameters “username”, “long URL”, with their associated variable, “roguelynn” and “”.

There are different specifications to communicate with APIs, including REST, SOAP, XML-RPC, among others. Our tutorial will work with the REST protocol.