Skip to content

Instantly share code, notes, and snippets.

@jacobg
Created May 31, 2013 14:59
Show Gist options
  • Save jacobg/5685574 to your computer and use it in GitHub Desktop.
Save jacobg/5685574 to your computer and use it in GitHub Desktop.
Fareclock API sample for Python
from httplib import HTTPSConnection
from urllib import urlencode
token = '{{ MY API KEY }}'
params = {
'from': '2013-05-31',
'to': '2013-05-31',
#'paylocation': 0,
#'clocklocation': 0,
#'employee': 0,
#'department': 0,
#'status': 'all'
}
headers = {
'Authorization': 'Token ' + token
}
conn = HTTPSConnection("fare-clock.appspot.com")
conn.request('GET', "/api/punches/?" + urlencode(params), headers=headers)
res = conn.getresponse()
result = res.read()
print 'Result: ' + result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment