This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: urllib.urlretrieve/URLopener.retrieve - 'buff' argument
Type: Stage:
Components: Library (Lib) Versions:
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: dsuch, georg.brandl
Priority: normal Keywords: patch

Created on 2007-06-05 22:24 by dsuch, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit dsuch, 2007-06-05 22:24 diff dsuch, 2007-06-05 22:25 diff
Messages (4)
msg52729 - (view) Author: Dariusz Suchojad (dsuch) Date: 2007-06-05 22:24

attached is a tiny patch which adds to urllib.urlretrieve and urllib.URLopener.retrieve
an optional 'buff' argument, which should be a file-like object 
(e.g. a StringIO instance). I don't have any performance issues with creating
temporary files (right now, anyway..) but it would be nice if I could pass my 
own objects for those methods to write to.

Optionally, it could also raise an exception (ValueError?) if neither 'filename'
nor 'buff' were given on input.

Diffed against today's trunk.

What do you think? Make sense?
msg52730 - (view) Author: Dariusz Suchojad (dsuch) Date: 2007-06-05 22:25
Adding a diff.
File Added:
msg52731 - (view) Author: Dariusz Suchojad (dsuch) Date: 2007-06-06 08:34
Uh, of course I meant the other way around - it could raise an exception if both 'filename' and 'buff' were given on input.
msg61276 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-01-20 12:11
Why don't you use open() and transfer the data between file objects
yourself? The point of retrieve() is to create a local file containing
the data.

Closing as "won't fix".
Date User Action Args
2022-04-11 14:56:24adminsetgithub: 45044
2008-01-20 12:11:26georg.brandlsetstatus: open -> closed
resolution: wont fix
messages: + msg61276
nosy: + georg.brandl
2007-06-05 22:24:48dsuchcreate