Re: Decompressing a file retrieved by URL seems too complex

2010-08-12 Thread Aahz
In article <4c645c39$0$1595$742ec...@news.sonic.net>, John Nagle wrote: > >I'm reading a URL which is a .gz file, and decompressing it. This >works, but it seems far too complex. Yet none of the "wrapping" >you might expect to work actually does. You can't wrap a GzipFile >around an HTTP conne

Re: Decompressing a file retrieved by URL seems too complex

2010-08-12 Thread Thomas Jollans
On Thursday 12 August 2010, it occurred to John Nagle to exclaim: > (Repost with better indentation) Good, good. > > def readurl(url) : > if url.endswith(".gz") : The file name could be anything. You should be checking the reponse Content- Type header -- that's what it's for. > n

Decompressing a file retrieved by URL seems too complex

2010-08-12 Thread John Nagle
(Repost with better indentation) I'm reading a URL which is a .gz file, and decompressing it. This works, but it seems far too complex. Yet none of the "wrapping" you might expect to work actually does. You can't wrap a GzipFile around an HTTP connection, because GzipFile, reasonably enough,

Decompressing a file retrieved by URL seems too complex

2010-08-12 Thread John Nagle
I'm reading a URL which is a .gz file, and decompressing it. This works, but it seems far too complex. Yet none of the "wrapping" you might expect to work actually does. You can't wrap a GzipFile around an HTTP connection, because GzipFile, reasonably enough, needs random access, and tries t