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

Commit c22f51e

Browse files
committed
Merge branch 'master' of https://github.com/grokkers/cr-api-py
2 parents 03cdb5f + d2a1c1c commit c22f51e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

crasync/core.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ class Client:
1818
def __init__(self, session=None):
1919
self.session = session or aiohttp.ClientSession()
2020

21-
22-
async def get_profile(self, *, tags):
21+
async def get_profile(self, *tags):
2322
'''Get a profile object using tag(s)'''
2423

24+
if ', ' in tags:
25+
raise SyntaxError("Read the docs please")
26+
2527
tags = ','.join(tags)
2628

2729
url = f'{self.BASE}/profile/{tags}'
@@ -31,6 +33,9 @@ async def get_profile(self, *, tags):
3133
data = await resp.json()
3234
else:
3335
raise ConnectionError(f'API not responding: {resp.status}')
36+
37+
if 'error' in data:
38+
raise NameError('Invalid Tag')
3439

3540
if isinstance(data, list):
3641
return [Profile(self, c) for c in data]
@@ -40,6 +45,9 @@ async def get_profile(self, *, tags):
4045
async def get_clan(self, *tags):
4146
'''Get a clan object using tag(s)'''
4247

48+
if ', ' in tags:
49+
raise SyntaxError("Read the docs please")
50+
4351
tags = ','.join(tags)
4452

4553
url = f'{self.BASE}/clan/{tags}'
@@ -49,6 +57,9 @@ async def get_clan(self, *tags):
4957
data = await resp.json()
5058
else:
5159
raise ConnectionError(f'API not responding: {resp.status}')
60+
61+
if 'error' in data:
62+
raise NameError('Invalid Tag')
5263

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

0 commit comments

Comments
 (0)