source: Matthew Henry from Burst.
In this tutorial we give an overview of how to use APIs (Application Programming Interfaces) to retrieve data. Via API one is able to retrieve real time data as well as historical data. An example of interesting business application involves combining real time data together with historical data to predict demand of products.
We start this tutorial with some basics on JSON (JavaScript Object Notation) files which are standard form for transferring data through APIs. After that we start exploring some APIs starting by a simple one: The Open Movie database (OMDb) API. Then we take a look on how to get information from both NS and KNMI Weer APIs (Weerlive and meteoserver) . To close it we check out how to pull data from Twitter.
Some JSON files built from data of OMDb are available here.
Models to be used to keep you APIs keys and Twitter credentials can be found in this folder.
Important: Remember to list these files in your .gitignore file to keep them safe when making your code available in GitHub, for example.
requests
: HTTP library for Python that allows us to send HTTP requests in a simple way.python-twitter
, a python wrapper around the Twitter API.
- Install requirements using
pip install -r requirements.txt
.- Make sure you use Python 3.
- You may want to use a virtual environment for this.