Skip to content

Commit dfa5f7a

Browse files
committed
Update examples to properly close the client & loop, remove a stray f from f-string.
1 parent 970d177 commit dfa5f7a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ This example will get a player with a certain tag, and search for 5 clans with a
4848
.. code:: py
4949
5050
import coc
51-
import asyncio
5251
5352
client = coc.login('email', 'password')
5453
@@ -62,11 +61,12 @@ This example will get a player with a certain tag, and search for 5 clans with a
6261
6362
try:
6463
war = await client.get_current_war("#clantag")
65-
print(f"{0.clan_tag} is currently in {0.state} state.".format(war))
64+
print("{0.clan_tag} is currently in {0.state} state.".format(war))
6665
except coc.PrivateWarLog:
6766
print("Uh oh, they have a private war log!")
6867
6968
client.loop.run_until_complete(main())
69+
client.close()
7070
7171
Basic Events Example
7272
---------------------

examples/war_logs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ async def get_warlog_opponents_from_clan_name(name: str, no_of_clans: int):
4646

4747

4848
if __name__ == "__main__":
49-
loop = asyncio.get_event_loop()
50-
loop.run_until_complete(get_warlog_opponents_from_clan_name("name", 5))
49+
client.loop.run_until_complete(get_warlog_opponents_from_clan_name("name", 5))
50+
client.close()

0 commit comments

Comments
 (0)