Skip to content

Commit

Permalink
Support wakapi
Browse files Browse the repository at this point in the history
  • Loading branch information
solonovamax committed Nov 4, 2022
1 parent fbc6199 commit 58a5e8c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"]:
Expand Down

0 comments on commit 58a5e8c

Please sign in to comment.