D
D
DarkMode2017-09-20 14:29:36
Python
DarkMode, 2017-09-20 14:29:36

How to send post request(s) many and different?

async def fetch(url, session):
    async with session.post(url,data=params) as response:
        return await response.read()

async def run(r):
    url = 'http://www.temp-mail.ru'
    tasks = []
    async with ClientSession() as session:
        for i in range(r):
            task = asyncio.ensure_future(fetch(url.format(i), session))
            tasks.append(task)

        responses = await asyncio.gather(*tasks)
        print(responses)

How to send different parameters in such a script so that params ={'mail':'kappa{}@somethng.com'}.format(something) changes, and how to regulate this matter.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question