Chapter 12. The Internet

The Internet is a pervasive aspect of modern computing. Even small, single-use scripts frequently interact with remote services to send or receive data. Python’s rich set of tools for working with web protocols makes it well suited for programming web-based applications, either as a client or as a server.

The urllib.parse (page 753) module manipulates URL strings, splitting and combining their components, and is useful in clients and servers.

The urllib.request (page 761) module implements an API for retrieving content remotely.

HTTP POST requests are usually “form encoded” with urllib. Binary data sent through a POST should be encoded with base64 (page 776) first, to comply with the message format standard.

Well-behaved ...

Get The Python 3 Standard Library by Example, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.