Name Description Size
__init__.py 0
background_tasks.py Example of aiohttp.web.Application.on_startup signal handler 1948
basic_auth_middleware.py Example of using basic authentication middleware with aiohttp client. This example shows how to implement a middleware that automatically adds Basic Authentication headers to all requests. The middleware encodes the username and password in base64 format as required by the HTTP Basic Auth specification. This example includes a test server that validates basic auth credentials. 6441
cli_app.py Example of serving an Application using the `aiohttp.web` CLI. Serve this app using:: $ python -m aiohttp.web -H localhost -P 8080 --repeat 10 cli_app:init \ > "Hello World" Here ``--repeat`` & ``"Hello World"`` are application specific command-line arguments. `aiohttp.web` only parses & consumes the command-line arguments it needs (i.e. ``-H``, ``-P`` & ``entry-func``) and passes on any additional arguments to the `cli_app:init` function for processing. 1495
client_auth.py 551
client_json.py 489
client_ws.py websocket cmd client for web_ws.py example. 2161
combined_middleware.py Example of combining multiple middleware with aiohttp client. This example shows how to chain multiple middleware together to create a powerful request pipeline. Middleware are applied in order, demonstrating how logging, authentication, and retry logic can work together. The order of middleware matters: 1. Logging (outermost) - logs all attempts including retries 2. Authentication - adds auth headers before retry logic 3. Retry (innermost) - retries requests on failure 10643
curl.py 1056
digest_auth_qop_auth.py Example of using digest authentication middleware with aiohttp client. This example shows how to use the DigestAuthMiddleware from aiohttp.client_middleware_digest_auth to authenticate with a server that requires digest authentication with different qop options. In this case, it connects to httpbin.org's digest auth endpoint. 2273
fake_server.py fakes -- dns -> port dict 4031
logging_middleware.py Example of using logging middleware with aiohttp client. This example shows how to implement a middleware that logs request timing and response status. This is useful for debugging, monitoring, and understanding the flow of HTTP requests in your application. This example includes a test server with various endpoints. 5707
lowlevel_srv.py 550
retry_middleware.py Example of using retry middleware with aiohttp client. This example shows how to implement a middleware that automatically retries failed requests with exponential backoff. The middleware can be configured with custom retry statuses, maximum retries, and backoff parameters. This example includes a test server that simulates various HTTP responses and can return different status codes on sequential requests. 8899
server.crt 1103
server.csr 952
server.key 1675
server_simple.py 718
static_files.py 181
token_refresh_middleware.py Example of using token refresh middleware with aiohttp client. This example shows how to implement a middleware that handles JWT token refresh automatically. The middleware: - Adds bearer tokens to requests - Detects when tokens are expired - Automatically refreshes tokens when needed - Handles concurrent requests during token refresh This example includes a test server that simulates a JWT auth system. Note: This is a simplified example for demonstration purposes. In production, use proper JWT libraries and secure token storage. 12292
web_classview.py Example for aiohttp.web class based views. 1505
web_cookies.py Example for aiohttp.web basic server with cookies. 936
web_rewrite_headers_middleware.py Example for rewriting response headers by middleware. 687
web_srv.py Example for aiohttp.web basic server. 1384
web_srv_route_deco.py Example for aiohttp.web basic server with decorator definition for routes. 1359
web_srv_route_table.py Example for aiohttp.web basic server with table definition for routes. 1460
web_ws.py Example for aiohttp.web websocket server. 1913
websocket.html 3034