I am trying to write a script in python to loop through a list of lat/long coordinates and send each set through a boundary API call. I want to write each individual API response.
import json
import requests
coords = ['lat1, long1','lat2, long2','lat3, long3']
for x in coords:
loc={'?contains':'x','&sets':'a_parameter'}
response = requests.get('http://apicall.com/', params=loc)
data = response.json()
print data
I know that this is not the proper way to syntax the 'x' within the API call, but I cannot find documentation of a for loop including a requests API call.
xvariable don't quote it. Are you wishing to group together lat-lng pairs of your list?syntax the x?