Skip to content
This repository was archived by the owner on Aug 19, 2018. It is now read-only.

Commit 0935163

Browse files
authored
Merge pull request #2 from kwugfighter/patch-1
return None when tag is invalid
2 parents 87e6e90 + 67a03d4 commit 0935163

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

crasync/core.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ async def get_profile(self, *, tags):
3131
data = await resp.json()
3232
else:
3333
raise ConnectionError(f'API not responding: {resp.status}')
34+
35+
if "error" in data:
36+
return None
3437

3538
if isinstance(data, list):
3639
return [Profile(self, c) for c in data]
@@ -49,6 +52,9 @@ async def get_clan(self, *, tags):
4952
data = await resp.json()
5053
else:
5154
raise ConnectionError(f'API not responding: {resp.status}')
55+
56+
if "error" in data:
57+
return None
5258

5359
if isinstance(data, list):
5460
return [Clan(self, c) for c in data]

0 commit comments

Comments
 (0)