G
gervaz
Hi all, I need to fetch some html pages and it is required to have
cookies enabled. So, I'm using
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor
())
urllib.request.install_opener(opener)
as a global instance. Is there a way to always use a default header
like:
{"User-Agent": "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:
1.9.1.5) Gecko/20091102 Firefox/3.5.5"}
instead of always creating urllib.request.Request(my_url, None,
headers) and call different urls with the same
cookies?
Thanks, Mattia
cookies enabled. So, I'm using
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor
())
urllib.request.install_opener(opener)
as a global instance. Is there a way to always use a default header
like:
{"User-Agent": "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:
1.9.1.5) Gecko/20091102 Firefox/3.5.5"}
instead of always creating urllib.request.Request(my_url, None,
headers) and call different urls with the same
cookies?
Thanks, Mattia