You've already forked wakapi-readme-stats
FIX: Added Error Handling
This commit is contained in:
13
main.py
13
main.py
@@ -155,6 +155,13 @@ def generate_commit_list():
|
|||||||
def get_stats():
|
def get_stats():
|
||||||
'''Gets API data and returns markdown progress'''
|
'''Gets API data and returns markdown progress'''
|
||||||
stats = ''
|
stats = ''
|
||||||
|
|
||||||
|
if showCommit.lower() in ['true', '1', 't', 'y', 'yes']:
|
||||||
|
try:
|
||||||
|
stats = stats + generate_commit_list() + '\n\n'
|
||||||
|
except Exception as ex:
|
||||||
|
print("GitHub Personal access token not configured properly or invalid" + str(ex))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
request = requests.get(
|
request = requests.get(
|
||||||
f"https://wakatime.com/api/v1/users/current/stats/last_7_days?api_key={waka_key}")
|
f"https://wakatime.com/api/v1/users/current/stats/last_7_days?api_key={waka_key}")
|
||||||
@@ -189,12 +196,6 @@ def get_stats():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Waka Time Api Key Not Configured" + str(e))
|
print("Waka Time Api Key Not Configured" + str(e))
|
||||||
|
|
||||||
if showCommit.lower() in ['true', '1', 't', 'y', 'yes']:
|
|
||||||
try:
|
|
||||||
stats = stats + generate_commit_list() + '\n\n'
|
|
||||||
except Exception as ex:
|
|
||||||
print("GitHub Personal access token not configured properly or invalid" + str(ex))
|
|
||||||
|
|
||||||
return stats
|
return stats
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user