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

Merged
merged 1 commit into from Jun 8, 2012

Conversation

Projects
None yet
3 participants
@Bluehorn
Contributor

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.

Torsten Landschoff
Allow passing a file or file-like object as data.
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

This comment has been minimized.

Show comment Hide comment
@travisbot

travisbot Jun 7, 2012

This pull request passes (merged f0e327f into c0ae3dd).

This pull request passes (merged f0e327f into c0ae3dd).

@kennethreitz

This comment has been minimized.

Show comment Hide comment
@kennethreitz

kennethreitz Jun 8, 2012

Owner

This is a great change, thanks!

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

Owner

kennethreitz commented Jun 8, 2012

This is a great change, thanks!

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

kennethreitz added a commit that referenced this pull request Jun 8, 2012

Merge pull request #659 from Bluehorn/develop
Allow passing a file or file-like object as data.

@kennethreitz kennethreitz merged commit 78eecd7 into requests:develop Jun 8, 2012

@kennethreitz

This comment has been minimized.

Show comment Hide comment
@kennethreitz

kennethreitz Jun 8, 2012

Owner

🍰

Owner

kennethreitz commented Jun 8, 2012

🍰

kennethreitz added a commit that referenced this pull request Jun 8, 2012

@Bluehorn

This comment has been minimized.

Show comment Hide comment
@Bluehorn

Bluehorn Jun 8, 2012

Contributor

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

Contributor

Bluehorn commented Jun 8, 2012

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment