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 a server.
The urlparse
module manipulates URL strings, splitting and combining their components, and is useful in clients and servers.
There are two client-side APIs for accessing web resources. The original urllib
and updated urllib2
offer similar APIs for retrieving content remotely, but urllib2
is easier to extend with new protocols and the urllib2.Request
provides a way to add custom headers to outgoing requests.
HTTP POST requests ...
Get The Python Standard Library by Example 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.