2
我使用python urllib2.urlopen獲取html內容,我得到一個gziped響應。
我可以設置標題,所以我會得到它不拉鍊?我如何設置一個標題,防止網站發送gzip編碼響應
我的代碼
response = urlopen(url,None , TIMEOUT)
html = response.read() # read html
print html
爲Tichodroma建議我試試這個
request = Request(url)
request.add_header('Accept-encoding', 'text/plain')
response = urlopen(request,None , TIMEOUT)
html = response.read().lower() # read html
print html
現在它正在
http://stackoverflow.com/questions/3947120/dose-python-urllib2-will-automaticly-uncompress-gzip-data-from-fetch完全重複 - 網頁 – 2012-02-02 11:47:26
沒有它不是重複 - 我不想解壓縮它我想要得到它不在第一個位置 – yossi 2012-02-02 12:37:25