1
我正在嘗試使用Python獲取頁面,並使用cookie jar。使用url2lib檢查請求標題
jar = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))
opener.addheaders = [('User-agent', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)')]
response = opener.open('http://www.example.com/')
print response.info()
使用上面,我能得到響應頭,但比其他Wireshark的,我可以看到請求頭? urllib2發送了什麼?