Book Image

Mastering Social Media Mining with Python

By : Marco Bonzanini
Book Image

Mastering Social Media Mining with Python

By: Marco Bonzanini

Overview of this book

Your social media is filled with a wealth of hidden data – unlock it with the power of Python. Transform your understanding of your clients and customers when you use Python to solve the problems of understanding consumer behavior and turning raw data into actionable customer insights. This book will help you acquire and analyze data from leading social media sites. It will show you how to employ scientific Python tools to mine popular social websites such as Facebook, Twitter, Quora, and more. Explore the Python libraries used for social media mining, and get the tips, tricks, and insider insight you need to make the most of them. Discover how to develop data mining tools that use a social media API, and how to create your own data analysis projects using Python for clear insight from your social data.
Table of Contents (10 chapters)

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, that offers basic request/response interactions, perfect for our educational purposes.

The httpbin.org web page (http://httpbin.org/), explains the various endpoints and their meaning. To showcase the use of the requests library, we will implement...