From 58a5e8c4feaba9505f63a25265ceaadb2585862d Mon Sep 17 00:00:00 2001 From: solonovamax Date: Fri, 4 Nov 2022 13:33:48 -0400 Subject: [PATCH] Support wakapi Fixes anmol098/waka-readme-stats#220. --- main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 5565eab..571c6b7 100644 --- a/main.py +++ b/main.py @@ -27,6 +27,7 @@ listReg = f"{START_COMMENT}[\\s\\S]+{END_COMMENT}" waka_key = os.getenv('INPUT_WAKATIME_API_KEY') +waka_url = os.getenv('INPUT_WAKATIME_URL', "https://wakatime.com") githubToken = os.getenv('INPUT_GH_TOKEN') showTimeZone = os.getenv('INPUT_SHOW_TIMEZONE') showProjects = os.getenv('INPUT_SHOW_PROJECTS') @@ -325,7 +326,7 @@ def generate_commit_list(tz): def get_waka_time_stats(): stats = '' request = requests.get( - f"https://wakatime.com/api/v1/users/current/stats/last_30_days?api_key={waka_key}") + f"https://{waka_url}/api/v1/users/current/stats/last_30_days?api_key={waka_key}") no_activity = translate["No Activity Tracked This Week"] if request.status_code == 401: @@ -486,7 +487,7 @@ def get_stats(github): if show_total_code_time.lower() in truthy: request = requests.get( - f"https://wakatime.com/api/v1/users/current/all_time_since_today?api_key={waka_key}") + f"https://{waka_url}/api/v1/users/current/all_time_since_today?api_key={waka_key}") if request.status_code == 401: print("Error With WAKA time API returned " + str(request.status_code) + " Response " + str(request.json())) elif "text" not in request.json()["data"]: