Skip to content

Instantly share code, notes, and snippets.

@clckwrkbdgr
Created June 20, 2016 10:47
Show Gist options
  • Save clckwrkbdgr/06f30ffaa0e65d94035f465b27c995d7 to your computer and use it in GitHub Desktop.
Save clckwrkbdgr/06f30ffaa0e65d94035f465b27c995d7 to your computer and use it in GitHub Desktop.
Fieldbook API example using Python: read a dictionary of values from fieldbook sheet
POST_URL='https://api.fieldbook.com/v1/<USER_ID>/<SHEET_ID>'
KEY='...'
SECRET='...'
def get_fieldbook_json():
try:
response = requests.get(POST_URL, auth=(KEY, SECRET))
if response.status_code != 200:
return None
return response.json()
except requests.exceptions.ConnectionError as e:
print(e)
def parse_response(response_json):
result = {}
for record in response_json:
result[record['<FIRST_COLUMN_ID>']] = record['<SECOND_COLUMN_ID>']
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment