Making 1 Million Anfragen mit aiohttp / asyncio - buchstäblich
Ich habe dieses Tutorial weiterverfolgt:https: //pawelmhm.github.io/asyncio/python/aiohttp/2016/04/22/asyncio-aiohttp.htm und alles funktioniert gut, wenn ich 50 000 Anfragen mache. Aber ich muss 1 Million API-Aufrufe ausführen und dann habe ich ein Problem mit diesem Code:
url = "http://some_url.com/?id={}"
tasks = set()
sem = asyncio.Semaphore(MAX_SIM_CONNS)
for i in range(1, LAST_ID + 1):
task = asyncio.ensure_future(bound_fetch(sem, url.format(i)))
tasks.add(task)
responses = asyncio.gather(*tasks)
return await responses
Weil Python 1 Million Aufgaben erstellen muss, bleibt es im Grunde nur zurück und druckt dannKilled
Nachricht im Terminal. Gibt es eine Möglichkeit, einen Generator zu verwenden, der aus einem vorgefertigten Satz (oder einer Liste) von URLs besteht? Vielen Dank