+ 3
Application Program Interfaces, or APIs, are commonly used to retrieve data from remote websites. Sites like Reddit, Twitter, and Facebook all offer certain data through their APIs. To use an API, you make a request to a remote web server, and retrieve the data you need.
But why use an API instead of a static dataset you can download? APIs are useful in the following cases:
The data is changing quickly. An example of this is stock price data. It doesnât really make sense to regenerate a dataset and download it every minute â this will take a lot of bandwidth, and be pretty slow.
You want a small piece of a much larger set of data. Reddit comments are one example. What if you want to just pull your own comments on Reddit? It doesnât make much sense to download the entire Reddit database, then filter just your own comments.
There is repeated computation involved. Spotify has an API that can tell you the genre of a piece of music. You could theoretically create your own classifier, and use it to categorize music, but youâll never have as much data as Spotify does.
In cases like the ones above, an API is the right solution. In this blog post, weâll be querying a simple API to retrieve data about the International Space Station (ISS). Using an API will save us time and effort over doing all the computation ourselves.
API Requests
APIs are hosted on web servers. When you type www.google.com in your browserâs address bar, your computer is actually asking the www.google.com server for a webpage, which it then returns to your browser.
APIs work much the same way, except instead of your web browser asking for a webpage, your program asks for data. This data is usually returned in JSON format (for more on this, checkout our tutorial on working with JSON data).
read more in:
https://www.dataquest.io/blog/JUMP_LINK__&&__python__&&__JUMP_LINK-api-tutorial/
https://feelthecode.com/
https://realpython.com/blog/python/api-integration-in-python/



