Skip to main content

Python Timetric client

A client for Timetric (http://timetric.com/).

Requirements (easy-installable, listed as prereqs in setup.py):

  • httplib2

  • python-dateutil

  • oauth

  • simplejson

Usage:

>>> import timetric

# You need a config dict with at minimum your secret and key from Timetric
# (see the "Applications" pane of the settings page). In a real app you'll
# want to make this config persistant (the shelve module is a lightweight
# place to start) because the library will store OAuth authentication
# information back to this config.
>>> conf = {'consumer_secret': 'XXX', 'consumer_key': 'XXX'}
>>> client = timetric.TimetricClient(conf)

# The first time through you'll need to authorize your key with Timetric
# by sending the user to an authorization request page.
>>> import webbrowser
>>> webbrowser.open(client.get_authorize_url())

# Once the user has authorized at that page, you can continue.
>>> client.get_access_token()

# Now you're authorized and can read and write the user's series.
# It appears there's no API method to get a list of a particular
# user's series, so you need to somehow "know" the series ID.
>>> series = client.series('p-DpewL0TO-iBE4nMBCTsQ')

# Get the latest value
>>> series.latest()
(1236707269.0, 2.0)

# Iterate over the whole dataset
>>> for (timestamp, value) in series:
...     print timestamp, value
1236463646.39 3.0
1236486562.94 5.0
1236493503.37 6.0

# Update given a single value
>>> series.update(14)

# Update given an iterable of (time, value) pairs
>>> import time
>>> data = [(time.time() - 100, 11), (time.time() + 100, 15)]
>>> series.update(data)

# Update given a file of CSV data
>>> series.update(open('/tmp/data.csv'))

# Clear all the data out of the series
>>> series.delete()

Release files for timetric 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for timetric 1.0
File Size Uploaded
timetric-1.0.tar.gz 6.7 kB Details

Release files / timetric-1.0.tar.gz

Download URL timetric-1.0.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
84e504dabb84e92a1fef6357fa77b3629398e7bc9f39ea65ee1cdb3b4caca642
BLAKE2b-256 checksum
How to use checksums
df8813467bbb522f9a141edc9ea46310a56e3ecd1450face429832d48706f50a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

1.3

1 release file

1.2

1 release file

1.1

1 release file

This release

1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page