fix: prevent keyerror for show_total_code_time

This commit is contained in:
Prathamesh B
2021-12-05 17:02:49 +05:30
parent 709cac3eb9
commit 4b987dcaa2

View File

@@ -469,6 +469,8 @@ def get_stats(github):
f"https://wakatime.com/api/v1/users/current/all_time_since_today?api_key={waka_key}") f"https://wakatime.com/api/v1/users/current/all_time_since_today?api_key={waka_key}")
if request.status_code == 401: if request.status_code == 401:
print("Error With WAKA time API returned " + str(request.status_code) + " Response " + str(request.json())) print("Error With WAKA time API returned " + str(request.status_code) + " Response " + str(request.json()))
elif "text" not in request.json()["data"]:
print("User stats are calculating. Try again later.")
else: else:
data = request.json() data = request.json()
stats += '![Code Time](http://img.shields.io/badge/' + quote( stats += '![Code Time](http://img.shields.io/badge/' + quote(