Skip to content
Advertisement

How to convert a requests GET request in Python to asyncio with payloads?

I am trying to parallelize requests to the Wikidata API using Python’s asyncio module.

My current synchronous script does the following:

JavaScript

I am trying to do the same using asyncio, to send requests asynchronously.

From this blogpost and the documentation, I understood that I need something like:

JavaScript

However, I did not manage to find how to add these payloads in the request. Do I have to reconstruct the URL manually or is there a way to send the payloads in asyncio?

Advertisement

Answer

Try the following code

JavaScript
Advertisement