urllib, Python library

From wikieduonline
(Redirected from Urllib)
Jump to navigation Jump to search

https://docs.python.org/3/library/urllib.request.html

urllib.request
urllib.parse


Adding HTTP headers:

import urllib.request
req = urllib.request.Request('http://www.example.com/')
req.add_header('Referer', 'http://www.python.org/')
# Customize the default User-Agent header value:
req.add_header('User-Agent', 'urllib-example/0.1 (Contact: . . .)')
r = urllib.request.urlopen(req)

Related[edit]

See also[edit]

Advertising: