(client: httpx.AsyncClient,
base_url: str,
cc: str)
| 31 | |
| 32 | # tag::FLAGS3_ASYNCIO_GET_COUNTRY[] |
| 33 | async def get_country(client: httpx.AsyncClient, |
| 34 | base_url: str, |
| 35 | cc: str) -> str: # <1> |
| 36 | url = f'{base_url}/{cc}/metadata.json'.lower() |
| 37 | resp = await client.get(url, timeout=3.1, follow_redirects=True) |
| 38 | resp.raise_for_status() |
| 39 | metadata = resp.json() # <2> |
| 40 | return metadata['country'] # <3> |
| 41 | # end::FLAGS3_ASYNCIO_GET_COUNTRY[] |
| 42 | |
| 43 | # tag::FLAGS3_ASYNCIO_DOWNLOAD_ONE[] |
no test coverage detected