By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,362 Members | 1,365 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,362 IT Pros & Developers. It's quick & easy.

Re: URLLIb2 problem

P: n/a
On Mon, Jun 30, 2008 at 4:11 PM, <le*********@gmail.comwrote:
I am trying to write somecode of this kind :)

opener = urllib2.build_opener(urllib2.HTTPCookieProcessor() )
opener.addheaders = [
....
('Accept-Encoding','gzip,deflate'),
....
urllib2.install_opener(opener)

fu = urllib2.urlopen('http://www.google.com')
print fu.read()

I am not able to open any webpage as the content is junk
characters.something like below..what could be the
problem?????????????
You told the website that you would accept gzip encoded data, and it
looks like the website decided to send you some. You need to either
take that header out of your opener, or actually handle the gzipped
data that's being sent back to you.

--
Jerry
Jun 30 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.