I was wondering if there was any way to make this script a lot faster - like instantly create 1000 accounts for example or at least in a matter of a few seconds. I’ve tried doing some async stuff myself but this is as far as I could get, I am just a beginner with asynchronous programming so any help is appreciated.
import asyncio
import aiohttp
async def make_numbers(numbers, _numbers):
for i in range(numbers, _numbers):
yield i
async def make_account():
url = "https://example.com/sign_up.php"
async with aiohttp.ClientSession() as session:
async for x in make_numbers(35691, 5000000):
async with session.post(url, data ={
"terms": 1,
"captcha": 1,
"email": "user%s@hotmail.com" % str(x),
"full_name": "user%s" % str(x),
"password": "123456",
"username": "auser%s" % str(x)
}) as response:
data = await response.text()
print("-> Creating account number %d" % x)
print (data)
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(make_account())
finally:
loop.close()