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 service, a web service, ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.