Skip to content

Instantly share code, notes, and snippets.

@kipanshi
Created April 8, 2013 10:44
Show Gist options
  • Save kipanshi/5335881 to your computer and use it in GitHub Desktop.
Save kipanshi/5335881 to your computer and use it in GitHub Desktop.
Testing oDesk API using ``python-odesk`` package
"""
(1) Create pair of oAuth 1.0 keys with "Desktop" types. Allow permissions for time and financial reports.
(2) Download ``odesk_meter.py`` from https://github.com/kipanshi/odesk_meter
(3) In the shell run the follwing:
"""
from odesk_meter import get_client
client = get_client(authorize=True)
client.get('https://www.odesk.com/api/auth/v1/info') # get authorized me
MY_ODESK_UID = 'Fill me'
client.timereport.get_provider_report(MY_ODESK_UID, "SELECT worked_on, provider_id, provider_name, sum(hours) WHERE worked_on >= '2013-04-01' AND worked_on <= '2013-04-05'")
client.get("https://www.odesk.com/gds/timereports/v1/providers/{0}?tq=SELECT worked_on, provider_id, provider_name, sum(hours) WHERE worked_on >= '2013-04-01' AND worked_on <= '2013-04-05'&tqx=out:json".format(MY_ODESK_UID))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment