You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For uploading large files with MultipartEncoderMonitor, it would be helpful to be able to abort the upload. I think this could be done conveniently with the callback function, i.e. instead of
defread(self, size=-1):
string=self.encoder.read(size)
self.bytes_read+=len(string)
cb=self.callback(self)
ifcbisNone:
# The callback function normally returns `None`.returnstringelse:
# If it returns something else, the upload is stopped by raising an Exception.# This exception can be caught in a try-except statement wrapping around# the `requests.post(...` call.raiseMultipartEncoderAbort("MultipartEncoder streaming aborted by callback: {}".format(cb))
What do you think? Could something like this be included in requests_toolbelt or should I subclass MultipartEncoderMonitor in my own projects for this purpose?
The text was updated successfully, but these errors were encountered:
For uploading large files with
MultipartEncoderMonitor
, it would be helpful to be able to abort the upload. I think this could be done conveniently with thecallback
function, i.e. instead oftoolbelt/requests_toolbelt/multipart/encoder.py
Lines 400 to 404 in 70c1aba
one could do something like:
What do you think? Could something like this be included in requests_toolbelt or should I subclass
MultipartEncoderMonitor
in my own projects for this purpose?The text was updated successfully, but these errors were encountered: