[Patches] [Patch #100837] urllib patch to simplify POST form query

noreply@sourceforge.net noreply@sourceforge.net
Tue, 15 Aug 2000 11:09:30 -0700


Patch #100837 has been updated. 

Project: 
Category: None
Status: Open
Summary: urllib patch to simplify POST form query

Follow-Ups:

Date: 2000-Jul-10 05:49
By: VizNut

Comment:
(SourceForce tossed my comment for the original patch, so here it is.)


Current GET form query:

  filename, headers = urllib.urlretrieve( "%s?%s" %
                                          ( BASE_URL, urllib.urlencode( parms ) ),
                                          filename )

Desirable POST form query:

  filename, headers = urllib.urlretrieve( BASE_URL, filename,
                                          data=urllib.urlencode( parms ) )

Current POST form query:

  fp = urllib.urlopen( BASE_URL, urllib.urlencode( parms ) )
  
  tfp = open(filename, 'wb')
  bs = 1024*8
  block = fp.read(bs)
  while block:
      tfp.write(block)
      block = fp.read(bs)
  tfp.close()
  fp.close()

The latter is required because there is no way to feed the data parameters for the POST query to urlretrieve.  The chunked read is necessary because these forms sometimes generate datasets larger than virtual memory (as in this case).

-------------------------------------------------------

Date: 2000-Jul-12 07:04
By: moshez

Comment:
This looks cool! I'm +1 on this.
(I haven't tested this patch yet, so I'll need to. From a cursory glance at the implementation it looks quite straightforward)

-------------------------------------------------------

Date: 2000-Aug-15 10:33
By: tim_one

Comment:
Reassigned to Fred because Jeremy's gone.  Fred, know anything about this stuff?  Review or assign to someone else, please.
-------------------------------------------------------

Date: 2000-Aug-15 11:09
By: fdrake

Comment:
This patch requires documentation; please update to modify Doc/lib/liburllib.tex, or provide specific (unmarked) text in a comment.
-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=100837&group_id=5470