1try:
2 from urllib.request import Request, urlopen # Python 3
3except ImportError:
4 from urllib2 import Request, urlopen # Python 2
5
6req = Request('http://api.company.com/items/details?country=US&language=en')
7req.add_header('apikey', 'xxx')
8content = urlopen(req).read()
9
10print(content)