moved lispy from 02 to 18
This commit is contained in:
@@ -36,10 +36,10 @@ async def get_flag(session: aiohttp.ClientSession, # <2>
|
||||
resp.raise_for_status() # <3>
|
||||
return bytes()
|
||||
|
||||
async def download_one(session: aiohttp.ClientSession, # <4>
|
||||
async def download_one(session: aiohttp.ClientSession,
|
||||
cc: str,
|
||||
base_url: str,
|
||||
semaphore: asyncio.Semaphore,
|
||||
semaphore: asyncio.Semaphore, # <4>
|
||||
verbose: bool) -> Result:
|
||||
try:
|
||||
async with semaphore: # <5>
|
||||
|
||||
@@ -36,9 +36,9 @@ async def get_flag(session: aiohttp.ClientSession,
|
||||
return bytes()
|
||||
|
||||
# tag::FLAGS3_ASYNCIO_GET_COUNTRY[]
|
||||
async def get_country(session: aiohttp.ClientSession, # <1>
|
||||
async def get_country(session: aiohttp.ClientSession,
|
||||
base_url: str,
|
||||
cc: str) -> str:
|
||||
cc: str) -> str: # <1>
|
||||
url = f'{base_url}/{cc}/metadata.json'
|
||||
async with session.get(url) as resp:
|
||||
if resp.status == 200:
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
aiohttp==3.7.4
|
||||
aiohttp==3.7.4.post0
|
||||
async-timeout==3.0.1
|
||||
attrs==20.3.0
|
||||
certifi==2020.12.5
|
||||
attrs==21.2.0
|
||||
certifi==2021.5.30
|
||||
chardet==4.0.0
|
||||
idna==2.10
|
||||
requests==2.25.1
|
||||
urllib3==1.26.5
|
||||
tqdm==4.56.2
|
||||
charset-normalizer==2.0.4
|
||||
idna==3.2
|
||||
multidict==5.1.0
|
||||
requests==2.26.0
|
||||
tqdm==4.62.2
|
||||
typing-extensions==3.10.0.2
|
||||
urllib3==1.26.6
|
||||
yarl==1.6.3
|
||||
|
||||
@@ -38,6 +38,7 @@ class SlowHTTPRequestHandler(SimpleHTTPRequestHandler):
|
||||
"""Serve a GET request."""
|
||||
time.sleep(.5)
|
||||
if random() < self.error_rate:
|
||||
# HTTPStatus.IM_A_TEAPOT requires Python >= 3.9
|
||||
self.send_error(HTTPStatus.IM_A_TEAPOT, "I'm a Teapot")
|
||||
else:
|
||||
f = self.send_head()
|
||||
|
||||
Reference in New Issue
Block a user