Issue 1731720: urllib.urlretrieve/URLopener.retrieve - 'buff' argument (original) (raw)

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

Files
File name Uploaded Description Edit
urllib.py.diff dsuch,2007-06-05 22:24 urllib.py diff
test_urllib.py.diff dsuch,2007-06-05 22:25 test_urllib.py diff
Messages (4)
msg52729 - (view) Author: Dariusz Suchojad (dsuch) Date: 2007-06-05 22:24
Hello, 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: test_urllib.py.diff
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".
History
Date User Action Args
2022-04-11 14:56:24 admin set github: 45044
2008-01-20 12:11:26 georg.brandl set status: open -> closedresolution: wont fixmessages: + nosy: + georg.brandl
2007-06-05 22:24:48 dsuch create