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

Function get_flag

20-executors/getflags/flags_asyncio.py:26–30  ·  view source on GitHub ↗
(client: AsyncClient, cc: str)

Source from the content-addressed store, hash-verified

24 return cc
25
26async def get_flag(client: AsyncClient, cc: str) -> bytes: # <4>
27 url = f'{BASE_URL}/{cc}/{cc}.gif'.lower()
28 resp = await client.get(url, timeout=6.1,
29 follow_redirects=True) # <5>
30 return resp.read() # <6>
31# end::FLAGS_ASYNCIO_TOP[]
32
33# tag::FLAGS_ASYNCIO_START[]

Callers 1

download_oneFunction · 0.70

Calls 2

readMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected