From c1240349dd3bbda7267a991b1370f2338d821e8b Mon Sep 17 00:00:00 2001 From: Ave Ozkal Date: Tue, 4 Jun 2019 19:44:55 +0300 Subject: [PATCH] Remove hardcoded api domain (or rather make it less hardcoded) --- README.md | 1 + packages/wakatime/api.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d70ffed..c7c1e91 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ sublime-wakatime Metrics, insights, and time tracking automatically generated from your programming activity. +This is a fork, modified to make it easier to use with rana or any other wakatime-compatible time tracking tools. Installation ------------ diff --git a/packages/wakatime/api.py b/packages/wakatime/api.py index 16286a4..522d98f 100644 --- a/packages/wakatime/api.py +++ b/packages/wakatime/api.py @@ -27,6 +27,9 @@ from .packages import tzlocal log = logging.getLogger('WakaTime') +api_domain = "https://api.wakatime.com" +# api_domain = https://rana.lavatech.top/ + try: from .packages import requests @@ -49,7 +52,7 @@ def send_heartbeats(heartbeats, args, configs, use_ntlm_proxy=False): api_url = args.api_url if not api_url: - api_url = 'https://api.wakatime.com/api/v1/users/current/heartbeats.bulk' + api_url = '{}/api/v1/users/current/heartbeats.bulk'.format(api_domain) log.debug('Sending heartbeats to api at %s' % api_url) timeout = args.timeout if not timeout: @@ -171,7 +174,7 @@ def get_time_today(args, use_ntlm_proxy=False): fetch summary. """ - url = 'https://api.wakatime.com/api/v1/users/current/summaries' + url = '{}/api/v1/users/current/summaries'.format(api_domain) timeout = args.timeout if not timeout: timeout = 60