What do you want to save?
Add Code snippet
New code examples
-
Python 2021-11-19 22:59:17
urllib.request headers
try: from urllib.request import Request, urlopen # Python 3 except ImportError: from urllib2 import Request, urlopen # Python 2 req = Request('http://api.company.com/items/details?country=US&language=en') req.add_header('apikey', 'xxx') con... Add solution -
Python 2021-11-03 01:43:07
urllib.error.HTTPError: HTTP Error 403: Forbidden
from urllib.request import Request, urlopen req = Request('http://www.cmegroup.com/trading/products/#sortField=oi&sortAsc=false&venues=3&page=1&cleared=1&group=1', headers={'User-Agent': 'Mozilla/5.0'}) webpage = urlopen(req).read() Add solution -
Python 2021-09-12 01:43:03
urllib urlretrieve python 3
try: from urllib.request import Request, urlopen # Python 3 except ImportError: from urllib2 import Request, urlopen # Python 2 req = Request('http://api.company.com/items/details?country=US&language=en') req.add_header('apikey', 'xxx') con... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5