0

I need to upload CSV file using api-audience.yandex.ru but I cannot find a way to write correct POST request.

I can get the existing segments by writing in the headers Authorization part but I don't understand how the Content-Disposition works in python

https://yandex.ru/dev/audience/doc/segments/uploadfile.html

import requests
oauth_token = 
headers = {
    "Authorization": f"OAuth {oauth_token}",
    # "form-data": "--------------------------5b2a52c5c90f668a"
    # "Content-Disposition": 
    "Content-Type": "multipart/form-data"
}
file = {"file.csv": open('sample_phones.csv', "rb")}
url = "https://api-audience.yandex.ru/v1/management/segments/upload_csv_file"
response = requests.post(url, headers=headers, files=file)
Russo
  • 1

0 Answers0