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

Commit 12ba5bd

Browse files
committed
Made the example better.
1 parent b846b46 commit 12ba5bd

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

crasync/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
path.dirname(path.realpath(__file__)),
2929
'chests.json'
3030
)
31+
3132
with open(_path) as f:
3233
CHESTS = json.load(f)
3334

examples/example.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ async def main():
88
profile = await client.get_profile('2CYUUCC8')
99

1010
print(profile)
11-
print(profile.current_trophies)
11+
print('Current Trophies: ' + str(profile.current_trophies))
12+
chest_cycle = ', '.join([profile.get_chest(x) for x in range(10)])
13+
print(chest_cycle) # next 9 chests.
1214

1315
await profile.update() # updating the info
1416

15-
clan = await profile.get_clan() # get the players full clan info
17+
try:
18+
clan = await profile.get_clan() # get the players full clan info
19+
except ValueError:
20+
print('No Clan')
21+
else:
22+
print('Clan: '+ str(clan))
23+
print('Members: ' + str(len(clan.members)))
24+
await clan.update() # updating the info
25+
highest = await clan.members[0].get_profile() # top player
26+
print('Clan Top Player: '+ str(highest))
1627

17-
chests = profile.get_chests()
18-
19-
print(clan)
20-
print(len(clan.members))
21-
22-
await clan.update() # updating the info
23-
24-
highest = await clan.members[0].get_profile()
25-
26-
print(highest) # top player
27-
2828
loop = asyncio.get_event_loop()
2929
loop.run_until_complete(main())

0 commit comments

Comments
 (0)