Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > why not in python 2.4.3

Thread Tools

why not in python 2.4.3

John Machin
Posts: n/a
On 30/05/2006 12:44 AM, Rocco wrote:
> Thanks Serge.
> It's a gzip string.

Look, Ma, no gzip!!!

'<?xml version="1.0" encoding="UTF-8"?><rss

import urllib2
def takefeed(url):
request.add_header('User-Agent', 'Mozilla/4.0 (compatible; MSIE
5.5; Win
dows NT')
opener = urllib2.build_opener()
return data
print repr(d[:100])
Reply With Quote
Serge Orlov
Posts: n/a
John Machin wrote:
> On 29/05/2006 10:47 PM, Serge Orlov wrote:
> > Maybe urllib2 in
> > python 2.4 reports to the server that it supports compressed data but
> > doesn't decompress it when receives the reply?
> >

> Something funny is happening here. Others reported it working with 2.4.3
> and Rocco's original code as posted in this thread -- which works for me
> on 2.4.2, Windows XP.

It "works" for me too, returning raw uncompressed data.

> There was one suss thing about Rocco's problem description:
> First message ended with d=takefeed(url)
> But next message said print rss
> Is rss == d?

Nope. If you look at html tags, 2.3 code returns <feed> <generator> ...
whereas 2.4 code returns <rss> <channel> <generator> ... That may
explain why 2.3 result is not compressed and 2.4 result is compressed,
but that doesn't explain why 2.4 *is* compressed. I looked at python
2.4 httplib, I'm sure it's not a problem, quote from httplib:

# we only want a Content-Encoding of "identity" since we
# support encodings such as x-gzip or x-deflate.

I think there is a web accellerator sitting somewhere between Rocco and
Google server that is confused that Rocco is "misinforming" web server
saying he's using Firefox, but at the same time claiming that he cannot
handle compressed data. That's why they teach little kids: don't lie

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why :: ? Why not : ? Why not . ? <- less clutter ?!? Skybuck Flying C++ 16 08-25-2007 09:48 PM
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
why why why does function not work Horace Nunley ASP .Net 1 09-27-2006 09:52 PM
Cisco 2611 and Cisco 1721 : Why , why , why ????? Cisco 10 05-01-2005 08:49 AM