python-aiohttpHow to rate limit with Python Aiohttp?
Rate limiting with Python Aiohttp can be done using the aiohttp.ClientSession.get() method. This method takes an optional limit parameter which can be used to limit the number of requests per second.
Example code
import aiohttp
async with aiohttp.ClientSession() as session:
async with session.get('http://example.com', limit=2) as response:
print(response.status)
Output example
200
The code above limits the number of requests to 2 per second.
Helpful links
Related
- How to use keepalive with Python Aiohttp?
- How to use HTTP2 with Python Aiohttp?
- How to handle x-www-form-urlencoded with Python Aiohttp?
- How to get response code with Python Aiohttp?
- How to create a websocket server using Python Aiohttp?
- How to disable SSL verification in Python Aiohttp?
- How to create a connection pool with Python Aiohttp?
- How to create a server with Python Aiohttp?
- How to close a Python Aiohttp session?
- How to check if a session is closed with Python Aiohttp?
More of Python Aiohttp
- How to use keepalive with Python Aiohttp?
- How to handle x-www-form-urlencoded with Python Aiohttp?
- How to retry a request with Python Aiohttp?
- How to create a connection pool with Python Aiohttp?
- How to make request with basic HTTP auth using Python Aiohttp?
- How to get response code with Python Aiohttp?
- How to set request cookies with Python Aiohttp?
- How to reuse a session with Python Aiohttp?
- How to make parallel requests with Python Aiohttp?
- How to set a timeout for a Python aiohttp client?
See more codes...