Skip to content

Commit 95c736d

Browse files
committed
ran black
python -m black requests_api_steam.py
1 parent 84ab63a commit 95c736d

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

examples/requests_api_steam.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
# Ensure these are setup in settings.toml
1515
# Requires Steam Developer API key
16-
ssid = os.getenv('AP_SSID')
17-
appw = os.getenv('AP_PASSWORD')
18-
steam_usernumber = os.getenv('steam_id')
19-
steam_apikey = os.getenv('steam_api_key')
16+
ssid = os.getenv("AP_SSID")
17+
appw = os.getenv("AP_PASSWORD")
18+
steam_usernumber = os.getenv("steam_id")
19+
steam_apikey = os.getenv("steam_api_key")
2020

2121
# Initialize WiFi Pool (There can be only 1 pool & top of script)
2222
pool = socketpool.SocketPool(wifi.radio)
@@ -27,13 +27,14 @@
2727

2828
# Deconstruct URL
2929
# http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=XXXXXXXXXXXXXXXXXXXXX&steamid=XXXXXXXXXXXXXXXX&format=json
30-
Steam_OwnedGames_URL = ("http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?"
31-
+ "key="
32-
+ steam_apikey
33-
+ "&steamid="
34-
+ steam_usernumber
35-
+ "&format=json"
36-
)
30+
Steam_OwnedGames_URL = (
31+
"http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?"
32+
+ "key="
33+
+ steam_apikey
34+
+ "&steamid="
35+
+ steam_usernumber
36+
+ "&format=json"
37+
)
3738

3839
if sleep_time < 60:
3940
sleep_time_conversion = "seconds"
@@ -86,18 +87,17 @@
8687
# Print Keys to Serial
8788
steam_debug_keys = True # Set True to print Serial data
8889
if steam_debug_keys:
89-
9090
game_count = steam_response["response"]["game_count"]
9191
print("Total Games: ", game_count)
9292
total_minutes = 0
93-
93+
9494
for game in steam_response["response"]["games"]:
9595
total_minutes += game["playtime_forever"]
96-
total_hours = total_minutes/60
97-
total_days = total_minutes/60/24
98-
print(f'Total Hours: {total_hours}')
99-
print(f'Total Days: {total_days}')
100-
96+
total_hours = total_minutes / 60
97+
total_days = total_minutes / 60 / 24
98+
print(f"Total Hours: {total_hours}")
99+
print(f"Total Days: {total_days}")
100+
101101
print("Monotonic: ", time.monotonic())
102102

103103
print("\nFinished!")
@@ -109,4 +109,4 @@
109109
print("Failed to get data, retrying\n", e)
110110
time.sleep(60)
111111
continue
112-
time.sleep(sleep_time)
112+
time.sleep(sleep_time)

0 commit comments

Comments
 (0)