Building a custom Python client

Throughout the book, we accessed different social media platform through Python libraries, either officially supported by the social media server themselves or provided by third parties.

This section answers the question: what if they don't provide a Python client for their API (and there is no unofficial library either)?

HTTP made simple

In order to implement the calls to the desired API, the recommended library for easy HTTP interactions is requests. From our virtual environment, use the following command:

$ pip install requests

The requests library offers a straightforward interface to perform HTTP calls. In order to test the library, we're going to implement a simple client for the httpbin.org service, a web service, ...

Get Mastering Social Media Mining with Python now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.