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 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) |
Thanks! But where do I get rescuetime.api.service and rescuetime.api.access?
I found an implementation at https://github.com/OpenHorizonLabs/rescuetime-python3
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.