Remove hardcoded api domain (or rather make it less hardcoded)

This commit is contained in:
ave 2019-06-04 19:44:55 +03:00
parent 67d8b0d24f
commit c1240349dd
No known key found for this signature in database
GPG key ID: 09356ABAA42C842B
2 changed files with 6 additions and 2 deletions

View file

@ -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
------------

View file

@ -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