File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""Asynchronous Python client for the Geocaching API."""
22import asyncio
33from geocachingapi import GeocachingApi
4+ from geocachingapi .models import GeocachingApiEnvironment
45
56async def main ():
67 """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 )
911
1012if __name__ == "__main__" :
1113 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 11"""Test for Geocaching Api integration."""
2- from geocachingapi import GeocachingApi , GeocachingStatus
32import asyncio
43import logging
4+ from geocachingapi import GeocachingApi , GeocachingStatus
55from geocachingapi .models import GeocachingApiEnvironment
6- logging .basicConfig (level = logging .DEBUG )
76from my_token import TOKEN
7+ logging .basicConfig (level = logging .DEBUG )
88mylogger = logging .getLogger ()
99
1010async def test ():
11+ """Function to test GeocachingAPI integration"""
1112 status :GeocachingStatus = None
1213 api = GeocachingApi (token = TOKEN , environment = GeocachingApiEnvironment .Staging )
1314 status = await api .update ()
1415 print (status .user .reference_code )
15- assert (status .user .reference_code is not None )
16- assert (status .user .find_count is not None )
1716 await api .close ()
18- assert (False )
19-
20-
2117loop = asyncio .get_event_loop ()
2218loop .run_until_complete (test ())
2319loop .close ()
24-
You can’t perform that action at this time.
0 commit comments