What you will learn
- Make HTTP calls
- Parse JSON and YAML
- Build small CLIs
New to this? Start here
The basics, in plain English
Bash is great for short tasks, but once you need real logic, data handling, or talking to web services, Python is easier and clearer. Python is a beginner-friendly programming language used everywhere in automation.
- Python
- A popular, readable programming language good for scripts, tools, and APIs.
- Library / package
- Pre-written code others made that you import to avoid reinventing the wheel.
- import
- The keyword that pulls a library into your script so you can use it.
- JSON
- A common text format for structured data, used heavily when talking to web services.
- When to use it
- Reach for Python when bash gets messy: complex logic, parsing, or API calls.
01
When to reach for Python
Once you need data structures, real error handling, or API clients, Python beats bash. requests, click, and pyyaml are staples.
Try it yourself
python
import requests↳Bring in the HTTP client library.r = requests.get("https://api.example.com/health")↳Call the health endpoint and keep the response.r.raise_for_status()↳Throw an error if the response was 4xx or 5xx.print(r.json()["status"])↳Parse the JSON body and print the status field.↳ lines explain what each command does — only the commands get copied
Finished this topic?
Mark it done to earn 100 XP and keep your streak alive.