diff options
| author | Brandon C. Irizarry <brandon.irizarry@gmail.com> | 2026-04-16 17:36:54 -0400 |
|---|---|---|
| committer | Brandon C. Irizarry <brandon.irizarry@gmail.com> | 2026-04-16 17:36:54 -0400 |
| commit | 528f5c261ec6dc2d0090930d4e79a8fef72d3cbd (patch) | |
| tree | 1c8f45dfdeb7698d3c0812b4630c7f23f3297067 /main.py | |
| parent | 28bb531bd6eec1a9139944fd5b5d1d05a08becd2 (diff) | |
docs: add docstring to 'fetch'
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -34,6 +34,16 @@ def get_urls(filename: str, limit: int | None = None) -> list[str]: async def fetch(session: aiohttp.ClientSession, url: str, semaphore: asyncio.Semaphore) -> str: + """Fetch a URL under the given SESSION. + + Use SEMAPHORE to limit the number of tasks that can make an HTTP + request at at time. + + This function is the atomic task that executes concurrently with + its brethren to ping various websites. + + """ + try: async with semaphore, session.get(url) as response: print(".", end="", flush=True) |
