I am trying to make a program that iterates over a CSV file that only has one column and trying to pass it on as a request one-by-one, as the API can only handle one at a time.
This is the script so far:
import requests,csv
with open(r'C:/Users/Desktop/123.csv') as x:
reader = csv.reader(x)
for row in reader:
print (row[0])
r = requests.post("xxxyyyy.com",
data={
"ID": "xxx",
},
headers={
"Authorization" : "xxx",
"Content-type": "application/x-www-form-urlencoded",
"Accept": "application/json",
})
r_dict = r.json()
print(r_dict)
My problem is I do not know what to use to iterate over the CSV file and how to pass the string on as a JSON and then send it.