3

I have a python snippet for a posting a file onto an URL:

import requests
url = 'http://www.test.com/route'
files = {'pdf': open('/path/to/file/abc.pdf', 'rb'), 'variable_1': '1', 'variable_2': '2'}
r = requests.post(url, files=files)
print(r.status_code)

It works! And I am looking for the cURL equivalent for the same!

I have tried this:

curl -X POST   http://www.test.com/route   -H 'content-type: application/json'   -F pdf=@/path/to/file/abc.pdf   -F variable_1=1   -F variable_2=2

What would be the correct curl? Thanks!

4

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.