mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Raise ExternalError on 400+ responses for pug
This commit is contained in:
parent
bb81bae479
commit
4f1cf50779
1 changed files with 2 additions and 0 deletions
|
@ -16,6 +16,8 @@ class PugCommand(rc.Command):
|
|||
async def run(self, args: rc.CommandArgs, data: rc.CommandData) -> None:
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get("https://dog.ceo/api/breed/pug/images/random") as response:
|
||||
if response.status >= 400:
|
||||
raise rc.ExternalError(f"Request returned {response.status}")
|
||||
result = await response.json()
|
||||
assert "status" in result
|
||||
assert result["status"] == "success"
|
||||
|
|
Loading…
Reference in a new issue