This example demonstrates outbound HTTP from a Python Worker using synchronous Python HTTP clients known to work in the current runtime:
It intentionally calls their normal blocking-style APIs from inside the Worker handler.
First ensure that uv is installed:
https://docs.astral.sh/uv/getting-started/installation/#standalone-installer
Run:
uv run pywrangler devThen try:
curl http://localhost:8787/
curl http://localhost:8787/syncYou can also deploy with:
uv run pywrangler deploy| Endpoint | Description |
|---|---|
GET / |
Endpoint index |
GET /sync |
Fetch with requests.get(), urllib3.PoolManager().request(), and httpx.Client |
GET /all |
Alias for /sync |
This example is limited to synchronous package-backed clients that work in Python Workers. It does not include stdlib raw-socket clients such as urllib.request or http.client.