MCPcopy
hub / github.com/fluentpython/example-code-2e / get_flag

Function get_flag

20-executors/getflags/flags2_asyncio.py:24–30  ·  view source on GitHub ↗
(client: httpx.AsyncClient,  # <1>
                   base_url: str,
                   cc: str)

Source from the content-addressed store, hash-verified

22MAX_CONCUR_REQ = 1000
23
24async def get_flag(client: httpx.AsyncClient, # <1>
25 base_url: str,
26 cc: str) -> bytes:
27 url = f'{base_url}/{cc}/{cc}.gif'.lower()
28 resp = await client.get(url, timeout=3.1, follow_redirects=True) # <2>
29 resp.raise_for_status()
30 return resp.content
31
32async def download_one(client: httpx.AsyncClient,
33 cc: str,

Callers 1

download_oneFunction · 0.70

Calls 1

getMethod · 0.45

Tested by

no test coverage detected