From 528f5c261ec6dc2d0090930d4e79a8fef72d3cbd Mon Sep 17 00:00:00 2001 From: "Brandon C. Irizarry" Date: Thu, 16 Apr 2026 17:36:54 -0400 Subject: docs: add docstring to 'fetch' --- main.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'main.py') diff --git a/main.py b/main.py index e1c6273..000a962 100644 --- a/main.py +++ b/main.py @@ -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) -- cgit v1.2.3