import requests
import csv
url = "https://paneledgesandbox.//API/v3/surveys/id/import-responses"
with open('Cars.csv', 'r') as file:
payload = csv.reader(file)
print(payload)
headers = {
'X-API-TOKEN': 'zzzz',
'Content-Type': 'text/csv',
'Cookie': 'CPSessID=bb5b5cf55ceff2c2b8237810db3ca3a7; XSRF-TOKEN=XSRF_0wG1WMbV3G0ktBb'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)`
I am getting an error while trying to read a csv file in a post call using python.
I am not sure where exactly the issue is considering that using the with command, the file automatically closes.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…