Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing a file or file-like object as data. #659

Merged
merged 1 commit into from
Jun 8, 2012

Conversation

Bluehorn
Copy link

@Bluehorn Bluehorn commented Jun 7, 2012

The underlying httplib already allows passing an open file object as body
to its HTTPConnection.request method. I think requests should allow that
as well.

This also fixes issue #292 in requests. httplib will automatically add the content-length header if a real file object is passed. This will most likely break for non-file streams but it is a start.

The underlying httplib already allows passing an open file object as body
to its HTTPConnection.request method. I think requests should allow that
as well.
@travisbot
Copy link

This pull request passes (merged f0e327f into c0ae3dd).

@kennethreitz
Copy link
Contributor

This is a great change, thanks!

In the future, I plan to support streaming uploads with generators.

kennethreitz pushed a commit that referenced this pull request Jun 8, 2012
Allow passing a file or file-like object as data.
@kennethreitz kennethreitz merged commit 78eecd7 into psf:develop Jun 8, 2012
@kennethreitz
Copy link
Contributor

✨ 🍰 ✨

kennethreitz pushed a commit that referenced this pull request Jun 8, 2012
@Bluehorn
Copy link
Author

Bluehorn commented Jun 8, 2012

👍 Thanks for accepting and for adding me to the AUTHORS file for the few lines I contributed ;-)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants