use heartbeats api resource instead of old actions resource

This commit is contained in:
Alan Hamlett 2014-12-22 10:10:29 -06:00
parent 3008ff75f5
commit 45bfd7d940

View file

@ -40,7 +40,7 @@ except ImportError:
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'packages')) sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'packages'))
from .compat import u, open, is_py2, is_py3 from .compat import u, open, is_py3
from .queue import Queue from .queue import Queue
from .log import setup_logging from .log import setup_logging
from .project import find_project from .project import find_project
@ -251,10 +251,10 @@ def get_user_agent(plugin):
return user_agent return user_agent
def send_action(project=None, branch=None, stats={}, key=None, targetFile=None, def send_heartbeat(project=None, branch=None, stats={}, key=None, targetFile=None,
timestamp=None, isWrite=None, plugin=None, offline=None, timestamp=None, isWrite=None, plugin=None, offline=None,
hidefilenames=None, **kwargs): hidefilenames=None, **kwargs):
url = 'https://wakatime.com/api/v1/actions' url = 'https://wakatime.com/api/v1/heartbeats'
log.debug('Sending heartbeat to api at %s' % url) log.debug('Sending heartbeat to api at %s' % url)
data = { data = {
'time': timestamp, 'time': timestamp,
@ -401,7 +401,7 @@ def main(argv=None):
branch = project.branch() branch = project.branch()
project_name = project.name() project_name = project.name()
if send_action( if send_heartbeat(
project=project_name, project=project_name,
branch=branch, branch=branch,
stats=stats, stats=stats,
@ -412,7 +412,7 @@ def main(argv=None):
heartbeat = queue.pop() heartbeat = queue.pop()
if heartbeat is None: if heartbeat is None:
break break
sent = send_action(project=heartbeat['project'], sent = send_heartbeat(project=heartbeat['project'],
targetFile=heartbeat['file'], targetFile=heartbeat['file'],
timestamp=heartbeat['time'], timestamp=heartbeat['time'],
branch=heartbeat['branch'], branch=heartbeat['branch'],