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

Function get_flag

20-executors/getflags/flags2_asyncio_executor.py:25–31  ·  view source on GitHub ↗
(client: httpx.AsyncClient,  # <2>
                   base_url: str,
                   cc: str)

Source from the content-addressed store, hash-verified

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

Callers 1

download_oneFunction · 0.70

Calls 1

getMethod · 0.45

Tested by

no test coverage detected