🚨 Merged with-statements
This commit is contained in:
@@ -10,11 +10,12 @@ class _Response(BaseModel):
|
||||
|
||||
|
||||
async def get(game_id: str) -> _Response | None:
|
||||
async with ClientSession() as session:
|
||||
async with session.get(f"https://create.kahoot.it/rest/kahoots/{game_id}/card/?includeKahoot=true") as response:
|
||||
if response.status == 200:
|
||||
return _Response(**await response.json())
|
||||
elif response.status == 404:
|
||||
return None
|
||||
else:
|
||||
raise Exception(f"Unexpected response status: {response.status}")
|
||||
async with ClientSession() as session, session.get(
|
||||
f"https://create.kahoot.it/rest/kahoots/{game_id}/card/?includeKahoot=true"
|
||||
) as response:
|
||||
if response.status == 200:
|
||||
return _Response(**await response.json())
|
||||
elif response.status == 404:
|
||||
return None
|
||||
else:
|
||||
raise Exception(f"Unexpected response status: {response.status}")
|
||||
|
||||
Reference in New Issue
Block a user