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?
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