spencermathews
7/29/2015 - 1:22 AM

doarama-python-example.py

import requests

doarama_api_url = "https://www.doarama.com/api/0.2"
doarama_params = {'api-name': 'MY_API_NAME', 'api-key': 'MY_API_KEY', 'Accept': 'application/JSON'}

#  Query Activity Types
r = requests.get(doarama_api_url+"/activityType", headers=doarama_params)
print("Doarama Activity Types: {}".format(r.text))

#  Test Upload Activity
user_id = str(1234)
doarama_params.update({'user-id': user_id})
files = {'gps_track': open('MY_GPX_FILE.gpx', 'rb')}
r = requests.post(doarama_api_url+"/activity", headers=doarama_params, files=files)

print("Doarama Activity Upload: {}".format(r.text))