I have to make lots of post requests with varying parameters to an API. I currently for the parameter-dictionary using a loop and then run the request for each single one, which is very time consuming.
I stumbled upon the aiohttp asynchronous requests library, but it is not clear to me how to pass a variable as parameter, that will change for every request. The examples I found, all pass a constant set of headers or parameters for varying urls.
Example:
ohsome_url = 'https://api.ohsome.org/v0.9-ignite/elements/geometry/'
data = {'bpolys': ctybnds,
'keys': key,
'values': val}
ohsomeResponse = requests.post(ohsome_url, data=data).json()
The variables ctybnds, key, val are all extracted currently within the loop.
Thanks in advance for any insights!