-
-
Notifications
You must be signed in to change notification settings - Fork 561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: implement wakapi compatibility #256
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,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") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as you can see, for now the environmental variables defaults are defined in |
||
ghtoken = os.getenv('INPUT_GH_TOKEN') | ||
showTimeZone = os.getenv('INPUT_SHOW_TIMEZONE') | ||
showProjects = os.getenv('INPUT_SHOW_PROJECTS') | ||
|
@@ -98,7 +99,6 @@ | |
get_profile_traffic = Template("""/repos/$owner/$repo/traffic/popular/referrers""") | ||
truthy = ['true', '1', 't', 'y', 'yes'] | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this change is vital. Also it breaks pep. |
||
def run_v3_api(query): | ||
request = requests.get('https://api.github.com' + query, headers=headers) | ||
if request.status_code == 200: | ||
|
@@ -309,7 +309,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_7_days?api_key={waka_key}") | ||
f"https://{waka_url}/api/v1/users/current/stats/last_7_days?api_key={waka_key}") | ||
no_activity = translate["No Activity Tracked This Week"] | ||
|
||
if request.status_code == 401: | ||
|
@@ -468,8 +468,9 @@ def get_stats(github): | |
yearly_data = get_yearly_data() | ||
|
||
if show_total_code_time.lower() in truthy: | ||
actual_base_url = f"{waka_url}/api/" if "wakatime.com" in waka_url else f"{waka_url}/api/compat/wakatime/" | ||
request = requests.get( | ||
f"https://wakatime.com/api/v1/users/current/all_time_since_today?api_key={waka_key}") | ||
f"https://{actual_base_url}/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"]: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should shouw that this is an example link, changing it to something like
https://your-own-wakapi.dev
? Don't you think so?