From 42dfcf004bafde65f94376c38548e3544e3bd114 Mon Sep 17 00:00:00 2001 From: realpython-bot <42617967+realpython-bot@users.noreply.github.com> Date: Wed, 21 Oct 2026 06:08:29 +0000 Subject: [PATCH] Sync python-uv with the maintenance update of Managing Python Projects With uv: An All-in-One Solution Co-Authored-By: Claude Opus 5.5 --- python-uv/README.md | 7 +++++++ python-uv/main.py | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/python-uv/README.md b/python-uv/README.md index a4f7d38d9a..e674ad5ff3 100644 --- a/python-uv/README.md +++ b/python-uv/README.md @@ -1,3 +1,10 @@ # Managing Python Projects With `uv`: An All-in-One Solution This folder provides the code examples for the Real Python tutorial [Managing Python Projects With `uv`: An All-in-One Solution](https://realpython.com/python-uv/). + +The sample app uses the [Cat API](https://thecatapi.com/), which requires an API key. Get one from the Cat API website and store it in an environment variable called `CAT_API_KEY` before running the app: + +```sh +$ export CAT_API_KEY= +$ uv run main.py Persian +``` diff --git a/python-uv/main.py b/python-uv/main.py index 542fe1750b..edfe93abd6 100644 --- a/python-uv/main.py +++ b/python-uv/main.py @@ -1,11 +1,15 @@ import argparse +import os import sys import requests def get_breeds_info(): - response = requests.get("https://api.thecatapi.com/v1/breeds") + response = requests.get( + "https://api.thecatapi.com/v1/breeds", + headers={"x-api-key": os.environ.get("CAT_API_KEY", "")}, + ) response.raise_for_status() return response.json()