0

I have API and I need to send a .csv file using cURL in python. I do not know how to write this command on python.

curl --location --request POST 'http://**************' \
--header 'Accept: application/json' \
--header 'API-AUTH-TOKEN: **************' \
--form 'list=@"/C:/Users/1288956/Downloads/ozon_search_query_test.csv"'
    • means I can't show it
3

1 Answer 1

0

R.J. Adriaansen gave me a good answer: curlconverter.com

import requests

headers = {
    'Accept': 'application/json',
    'API-AUTH-TOKEN': '**************',
}

files = {
    'list': ('"/C:/Users/1288956/Downloads/ozon_search_query_test.csv"', open('"/C:/Users/1288956/Downloads/ozon_search_query_test.csv"', 'rb')),
}

response = requests.post('http:///**************', headers=headers, files=files)
Sign up to request clarification or add additional context in comments.

Comments

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.