In order to interact with the Twitter APIs, we need a Python client that implements the different calls to the API itself. There are several options as we can see from the official documentation (https://dev.twitter.com/overview/api/twitter-libraries). None of them are officially maintained by Twitter and they are backed by the open source community. While there are several options to choose from, some of them almost equivalent, so we will choose to use Tweepy here as it offers a wider support for different features and is actively maintained.
The library can be installed via pip
:
$ pip install tweepy==3.3.0
Tip
Python 3 compatibility
We're specifically installing version 3.3 of Tweepy, because of an issue with the latest version of Tweepy and Python 3, which prevents running the examples in our Python 3.4 environment. The issue was still unresolved at the time of writing, but it's likely to be fixed soon.
The first part of the interaction with the Twitter API...