Skip to content

Instantly share code, notes, and snippets.

@embr
Created February 4, 2013 17:03
Show Gist options
  • Save embr/4707996 to your computer and use it in GitHub Desktop.
Save embr/4707996 to your computer and use it in GitHub Desktop.
RescueTime Python API Example
# coding: utf-8
import pprint
import pandas as pd
from rescuetime.api.service import Service
from rescuetime.api.access import AnalyticApiKey
s = Service.Service()
k = AnalyticApiKey.AnalyticApiKey(open('rt_key').read(), s)
p = {}
p['restrict_begin'] = '2012-09-01'
p['restrict_end'] = '2013-02-04'
p['restrict_kind'] = 'activity'
p['perspective'] = 'interval'
d = s.fetch_data(k,p)
df = pd.DataFrame(d['rows'], columns=d['row_headers'])
print df
print df[:10]
print df['Date'].unique()
df.to_csv('rt_data_interval_activity_20120901.csv', index=False)
Copy link

ghost commented Oct 16, 2014

Thanks for sample ! I try to send a mail everytime I stay more than 2 hours on my computer per day and the api's doc is void.

@semenoffalex
Copy link

Thanks! But where do I get rescuetime.api.service and rescuetime.api.access?

@njanakiev
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment