1212async def main ():
1313 """Get the data from a *hole instance."""
1414 async with aiohttp .ClientSession () as session :
15- data = Hole ("192.168.0.215" , loop , session )
15+ data = Hole ("192.168.0.215" , session )
1616
1717 await data .get_versions ()
1818 print (json .dumps (data .versions , indent = 4 , sort_keys = True ))
@@ -32,18 +32,17 @@ async def main():
3232async def disable ():
3333 """Get the data from a *hole instance."""
3434 async with aiohttp .ClientSession () as session :
35- data = Hole ("192.168.0.215" , loop , session , api_token = API_TOKEN )
35+ data = Hole ("192.168.0.215" , session , api_token = API_TOKEN )
3636 await data .disable ()
3737
3838
3939async def enable ():
4040 """Get the data from a *hole instance."""
4141 async with aiohttp .ClientSession () as session :
42- data = Hole ("192.168.0.215" , loop , session , api_token = API_TOKEN )
42+ data = Hole ("192.168.0.215" , session , api_token = API_TOKEN )
4343 await data .enable ()
4444
45-
46- loop = asyncio .get_event_loop ()
47- loop .run_until_complete (main ())
48- loop .run_until_complete (disable ())
49- loop .run_until_complete (enable ())
45+ if __name__ == "__main__" :
46+ asyncio .run (main ())
47+ asyncio .run (disable ())
48+ asyncio .run (enable ())
0 commit comments