Files
dragonpilot/common/api/__init__.py

16 lines
431 B
Python
Raw Normal View History

2016-11-29 18:34:21 -08:00
import requests
2017-06-28 13:57:09 -07:00
from selfdrive.version import version
2017-05-11 12:41:17 -07:00
def api_get(endpoint, method='GET', timeout=None, access_token=None, **params):
2016-11-29 18:34:21 -08:00
backend = "https://api.commadotai.com/"
2017-05-11 12:41:17 -07:00
headers = {}
if access_token is not None:
headers['Authorization'] = "JWT "+access_token
2017-06-28 13:57:09 -07:00
headers['User-Agent'] = "openpilot-" + version
2017-05-11 12:41:17 -07:00
return requests.request(method, backend+endpoint, timeout=timeout, headers = headers, params=params)
2016-11-29 18:34:21 -08:00