Learn Python the Hard Way: A Deceptively Simple Introduction to the Terrifyingly Beautiful World of Computers and Data Science, 5th Edition
by Zed A. Shaw
Exercise 53
Getting Data from APIs
In this exercise you’ll access the application programmer interface (API) I use for my learncodethehardway.com website. In web development, an API is usually a combination of the following:
A web server that you can access with the HTTP protocol. You used HTTP when you used
urllibto get the beer production PDFs from the ttb.gov website. HTTP is also what your browser uses to display the web application to you.This web server responds in some data format that’s easily parsed. This is what differentiates a PDF from an API. Sure, you’re getting data on beer production from ttb.gov, but you have to parse that data out of a PDF. An API gives you the data ready to go in a format that loads directly into your application ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access