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

Refactor files handling. #20

Closed
fafhrd91 opened this issue Mar 24, 2014 · 7 comments
Closed

Refactor files handling. #20

fafhrd91 opened this issue Mar 24, 2014 · 7 comments
Labels

Comments

@fafhrd91
Copy link
Member

Right now it is not possible to use file object as data parameter for client request

@fafhrd91 fafhrd91 changed the title Allow to use file object for post request Refactor form data posting. Jul 5, 2014
@fafhrd91 fafhrd91 changed the title Refactor form data posting. Refactor files handling. Jul 6, 2014
fafhrd91 added a commit that referenced this issue Jul 6, 2014
@fafhrd91
Copy link
Member Author

fafhrd91 commented Jul 6, 2014

@asvetlov @popravich @kxepal does anyone use files uploading?

@kxepal
Copy link
Member

kxepal commented Jul 7, 2014

I have to, but not yet started implementation of required bits. As far as I can see 359f6e8 changes, this refactoring removes one required feature for me: handling both data and multiple files to organize multipart/mixed request, when both data and multiple files are specified and each has own Content-Type. I was hope to reuse data and files arguments to implement required wrapper. I'll make prototype to check my worries about later today and'll provide feedback then if you don't mind.

@fafhrd91
Copy link
Member Author

fafhrd91 commented Jul 7, 2014

with new code you can mix parameters and files, something like that:

aiohttp.request(
  'post', 'http://....',
  data = [
      ('field1', 'value'),
      ('field2', 'value2', 'plain/text'),
      ('field3', open(filename,'rt'), 'text/html', 'filename')]
)

@kxepal
Copy link
Member

kxepal commented Jul 7, 2014

Sweet!

@asvetlov
Copy link
Member

asvetlov commented Jul 7, 2014

@fafhrd91 I and @popravich didn't use file uploading yet.

@fafhrd91
Copy link
Member Author

fafhrd91 commented Jul 7, 2014

@kxepal you also can construct aiohttp.FormData object and pass it as request data

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants