Chapter 17: Working with APIs
Consuming APIs with Python
pip install requestsimport requests
# GET request
response = requests.get("https://jsonplaceholder.typicode.com/posts/1")
print(response.json())
# POST request
payload = {"title": "foo", "body": "bar", "userId": 1}
response = requests.post("https://jsonplaceholder.typicode.com/posts", json=payload)
print(response.json())Building APIs with Python
Advanced API Techniques
Exercises
Best Practices
PreviousChapter 16: Data Science and Machine Learning with PythonNextChapter 18: Automation with Python
Last updated