@@ -101,9 +101,11 @@ async def async_main():
101101 tokens = f.read()
102102 # Assign gathered tokens
103103 auth_mgr.oauth = OAuth2TokenResponse.parse_raw(tokens)
104- except FileNotFoundError :
105- print (f " File { tokens_file} isn`t found or it doesn`t contain tokens! " )
106- exit (- 1 )
104+ except FileNotFoundError as e:
105+ print (
106+ f " File { tokens_file} isn`t found or it doesn`t contain tokens! err= { e} "
107+ )
108+ sys.exit(- 1 )
107109
108110 """
109111 Refresh tokens, just in case
@@ -112,8 +114,8 @@ async def async_main():
112114 """
113115 try :
114116 await auth_mgr.refresh_tokens()
115- except HTTPStatusError:
116- print (" Could not refresh tokens" )
117+ except HTTPStatusError as e :
118+ print (f " Could not refresh tokens, err= { e } " )
117119 sys.exit(- 1 )
118120
119121 # Save the refreshed/updated tokens
@@ -131,29 +133,21 @@ async def async_main():
131133 """
132134 # Get friendslist
133135 friendslist = await xbl_client.people.get_friends_own()
134- print (" Your friends:" )
135- print (friendslist)
136- print ()
136+ print (f " Your friends: { friendslist} \n " )
137137
138138 # Get presence status (by list of XUID)
139139 presence = await xbl_client.presence.get_presence_batch(
140140 [" 2533274794093122" , " 2533274807551369" ]
141141 )
142- print (" Statuses of some random players by XUID:" )
143- print (presence)
144- print ()
142+ print (f " Statuses of some random players by XUID: { presence} \n " )
145143
146144 # Get messages
147145 messages = await xbl_client.message.get_inbox()
148- print (" Your messages:" )
149- print (messages)
150- print ()
146+ print (f " Your messages: { messages} \n " )
151147
152148 # Get profile by GT
153149 profile = await xbl_client.profile.get_profile_by_gamertag(" SomeGamertag" )
154- print (" Profile under SomeGamertag gamer tag:" )
155- print (profile)
156- print ()
150+ print (f " Profile under SomeGamertag gamer tag: { profile} \n " )
157151
158152
159153asyncio.run(async_main())
0 commit comments