requests / toolbelt

A toolbelt of useful classes and functions to be used with python-requests
https://toolbelt.readthedocs.org
Other
999 stars 186 forks source link

Uploading file in a complex object #320

Open marino-mrc opened 2 years ago

marino-mrc commented 2 years ago

Hi, I'm trying to reproduce the following curl command using toolbelt:

curl --include -X POST --form "instance[name]=Test Instance" --form "instance[file]=@testfile" http://192.168.122.127:3002/instances

Basically I have a "nested" dictionary with a file inside it: { 'instance': { 'name': "Test Instance", 'file': @testfile}

Please, can you share an example on how to do this? Thank you. Marco