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

Function get_flag

20-executors/getflags/flags.py:35–40  ·  view source on GitHub ↗
(cc: str)

Source from the content-addressed store, hash-verified

33 (DEST_DIR / filename).write_bytes(img)
34
35def get_flag(cc: str) -> bytes: # <6>
36 url = f'{BASE_URL}/{cc}/{cc}.gif'.lower()
37 resp = httpx.get(url, timeout=6.1, # <7>
38 follow_redirects=True) # <8>
39 resp.raise_for_status() # <9>
40 return resp.content
41
42def download_many(cc_list: list[str]) -> int: # <10>
43 for cc in sorted(cc_list): # <11>

Callers 2

download_oneFunction · 0.90
download_manyFunction · 0.70

Calls 1

getMethod · 0.45

Tested by

no test coverage detected