API's with Python
Python Workflow
Set Up venv
python -m venv .venv — isolated environment per project.
Install Dependencies
pip install -r requirements.txt — pin versions for reproducibility.
Write & Test
Write functions; test with pytest as you go.
Run & Deploy
python script.py locally, deploy to your platform of choice.
Noble Desktop's Python Programming Immersive covers AI APIs, data analysis, and modern Python development.
1Full Video Transcript
Hi, my name is Art. I teach Python. In this video, I'm going to show you how you could read data from APIs and how you could convert that data into some other Python data structure, such as maybe a Pandas DataFrame.
So what we're going to do: if you want to use Pandas, you need to import Pandas as PD. That's the first thing. Then we need to import another library: import requests. So what is requests? Requests is a small Python library, very popular.
2Understanding APIs and HTTP Requests
You have to understand what is an API. An API is some data served from a server. So you need to get online. Python cannot get online because Python is a programming language, so Python requires some help such as requests to literally get online and send requests to a server for data.
Now, most APIs require a lot of registration, and sometimes you need to provide credit card information. I don't want to do any of that, so here what we're going to be doing: apparently there is a very popular API, totally free, and that's based on a very popular cartoon, Rick and Morty. If you're fans, hey! They provide all these data about characters. So that would be your URL.