I am very new with aiohttp and asyncio so apologies for my ignorance up front. I am having difficulties with the event loop portion of the documentation and don't think my below code is executing asynchronously. I am trying to take the output of all combinations of two lists via itertools, and POST to XML. A more full blown version is listed here while using the requests module, however that is not ideal as I am needing to POST 1000+ requests potentially at a time. Here is a sample of how it looks now:
import aiohttp import asyncio import itertools skillid = ['7715','7735','7736','7737','7738','7739','7740','7741','7742','7743','7744','7745','7746','7747','7748' ,'7749','7750','7751','7752','7753','7754','7755','7756','7757','7758','7759','7760','7761','7762','7763','7764','7765','7766','7767','7768','7769','7770','7771','7772','7773','7774','7775','7776','7777','7778','7779','7780','7781','7782','7783','7784'] agent= ['5124','5315','5331','5764','6049','6076','6192','6323','6669','7690','7716'] url = 'https://url' user = 'user' password = 'pass' headers = { 'Content-Type': 'application/xml' } async def main(): async with aiohttp.ClientSession() as session: for x in itertools.product(agent,skillid): payload = "<operation><operationType>update</operationType><refURLs><refURL>/unifiedconfig/config/agent/" + x[0] + "</refURL></refURLs><changeSet><agent><skillGroupsRemoved><skillGroup><refURL>/unifiedconfig/config/skillgroup/" + x[1] + "</refURL></skillGroup></skillGroupsRemoved></agent></changeSet></operation>" async with session.post(url,auth=aiohttp.BasicAuth(user, password), data=payload,headers=headers) as resp: print(resp.status) print(await resp.text()) loop = asyncio.get_event_loop() loop.run_until_complete(main()) I see that coroutines can be used but not sure that applies as there is only a single task to execute. Any clarification is appreciated.