File tree 2 files changed +9
-11
lines changed
2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change 1
1
"""Asynchronous Python client for the Geocaching API."""
2
2
import asyncio
3
3
from geocachingapi import GeocachingApi
4
+ from geocachingapi .models import GeocachingApiEnvironment
4
5
5
6
async def main ():
6
7
"""Show example of using the Geocaching API"""
7
- async with GeocachingApi () as api :
8
- print ("test" )
8
+ async with GeocachingApi (token = "<insert your token here>" , environment = GeocachingApiEnvironment .Staging ) as api :
9
+ status = await api .update ()
10
+ print (status .user .reference_code )
9
11
10
12
if __name__ == "__main__" :
11
13
loop = asyncio .get_event_loop ()
12
- loop .run_until_complete (main ())
14
+ loop .run_until_complete (main ())
15
+
Original file line number Diff line number Diff line change 1
1
"""Test for Geocaching Api integration."""
2
- from geocachingapi import GeocachingApi , GeocachingStatus
3
2
import asyncio
4
3
import logging
4
+ from geocachingapi import GeocachingApi , GeocachingStatus
5
5
from geocachingapi .models import GeocachingApiEnvironment
6
- logging .basicConfig (level = logging .DEBUG )
7
6
from my_token import TOKEN
7
+ logging .basicConfig (level = logging .DEBUG )
8
8
mylogger = logging .getLogger ()
9
9
10
10
async def test ():
11
+ """Function to test GeocachingAPI integration"""
11
12
status :GeocachingStatus = None
12
13
api = GeocachingApi (token = TOKEN , environment = GeocachingApiEnvironment .Staging )
13
14
status = await api .update ()
14
15
print (status .user .reference_code )
15
- assert (status .user .reference_code is not None )
16
- assert (status .user .find_count is not None )
17
16
await api .close ()
18
- assert (False )
19
-
20
-
21
17
loop = asyncio .get_event_loop ()
22
18
loop .run_until_complete (test ())
23
19
loop .close ()
24
-
You can’t perform that action at this time.
0 commit comments