nick34992
2/17/2017 - 9:35 PM

Python Module: urllib: request, urlopen

Python Module: urllib: request, urlopen

#!/usr/bin/env python3

from urllib.request import Request, urlopen

req = Request('http://www.debian.org')
req.add_header('Accept-Language', 'sv')
response = urlopen(req)
for line in response:
    print(line.decode('utf-8'))
print(req.header_items())