GithubHelp home page GithubHelp logo

Refactor files handling. about aiohttp HOT 7 CLOSED

aio-libs avatar aio-libs commented on August 15, 2024
Refactor files handling.

from aiohttp.

Comments (7)

fafhrd91 avatar fafhrd91 commented on August 15, 2024

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

from aiohttp.

kxepal avatar kxepal commented on August 15, 2024

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.

from aiohttp.

fafhrd91 avatar fafhrd91 commented on August 15, 2024

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')]
)

from aiohttp.

kxepal avatar kxepal commented on August 15, 2024

Sweet!

from aiohttp.

asvetlov avatar asvetlov commented on August 15, 2024

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

from aiohttp.

fafhrd91 avatar fafhrd91 commented on August 15, 2024

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

from aiohttp.

lock avatar lock commented on August 15, 2024

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.

from aiohttp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.