![Python Machine Learning Blueprints](https://wfqqreader-1252317822.image.myqcloud.com/cover/939/36698939/b_36698939.jpg)
Acquisition
Since one of the more common ways to access data is through a RESTful API, one library that you'll want to be aware of is the Python Requests library, http://www.python-requests.org/en/latest/. Dubbed HTTP for humans, it makes interacting with APIs a clean and simple experience.
Let's take a look at a sample interaction, using requests to pull down data from GitHub's API. Here, we will make a call to the API and request a list of starred repositories for a user:
import requests r = requests.get(r"https://api.github.com/users/acombs/starred") r.json()
This will return a JSON of all the repositories the user has starred, along with attributes about each. Here is a snippet of the output for the preceding call:
![](https://epubservercos.yuewen.com/03AEAD/19470382401509006/epubprivate/OEBPS/Images/b91dee33-9507-4fe6-bc61-6f7ccf15254c.png?sign=1738847959-InWHbmDWyhWSdSZFdI7eF52fh7lk84SZ-0-d723f71c9b1645af9db31aba04205135)
The requests library has an amazing number of features—far too many to cover here, but I do suggest you check out the documentation.