Courses/Data Formats & Networking

๐ŸŒ Data Formats & Networking

HTTP with urllib

Fetch URLs from the standard library.

urllib.request ships with Python and can perform HTTP calls without any extra dependency.

from urllib.parse import urlencode

params = urlencode({"q": "python", "page": 2})
print(params)  # q=python&page=2

In a normal Python environment you'd then call urllib.request.urlopen(url) to perform the request.

main.py
Output
Press Run to execute.
Expected output
https://example.com/search?q=lovable&lang=en
example.com

Sign in to track your progress across lessons.