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
Sum Zbrod
  • 301
  • 2
  • 4

1 Answers1

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)
Sum Zbrod
  • 301
  • 2
  • 4