Created
February 4, 2013 17:03
-
-
Save embr/4707996 to your computer and use it in GitHub Desktop.
RescueTime Python API Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! But where do I get rescuetime.api.service and rescuetime.api.access?