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
I'd like it to be possible to pass in a file-like object as the source of request data, provided Content-Length and Content-Type headers have been specified already. Here's an example of what I'd like to do:
Interesting. I see no reason why we couldn't support that.
Supporting this everywhere would also force us to revisit the files parameter. Currently, it expects file-like objects. It should also accept bytes/unicode strings.
In this case, I'd imagine that the files parameter wouldn't even be used in Request.send(); by that point, the data could be put into one large file-like object with a computed Content-Length.
I'd like it to be possible to pass in a file-like object as the source of request data, provided
Content-Length
andContent-Type
headers have been specified already. Here's an example of what I'd like to do:Alternatively, requests could even recognise that I've passed in a
file
object and perform anos.fstat(file_like_obj.fileno())
automatically.Here's the bit of code that seems to be breaking:
https://github.com/kennethreitz/requests/blob/c7b99f78192bdff62fad4f92039396c0dfbe4fb8/requests/models.py#L267
When I pass in an object that is neither a string nor a dictionary, the call to
dict()
fails.I'm able and willing to work on this in a fork, I just figured it would be better to submit it as an issue first.
The text was updated successfully, but these errors were encountered: