fix API Call for sentry-client, add missing template
This commit is contained in:
parent
ae64024ef4
commit
67b19becc1
|
@ -8,13 +8,13 @@ from sentry.utils import json
|
|||
from .constants import BASE_DOMAIN
|
||||
|
||||
|
||||
class SupervisrApiError(Exception):
|
||||
class PassbookApiError(Exception):
|
||||
def __init__(self, message='', status=0):
|
||||
super(SupervisrApiError, self).__init__(message)
|
||||
super(PassbookApiError, self).__init__(message)
|
||||
self.status = status
|
||||
|
||||
|
||||
class SupervisrClient(object):
|
||||
class PassbookClient(object):
|
||||
def __init__(self, client_id, client_secret):
|
||||
self.client_id = client_id
|
||||
self.client_secret = client_secret
|
||||
|
@ -36,10 +36,10 @@ class SupervisrClient(object):
|
|||
headers=headers,
|
||||
)
|
||||
except RequestException as e:
|
||||
raise SupervisrApiError(unicode(e), status=getattr(e, 'status_code', 0))
|
||||
raise PassbookApiError(unicode(e), status=getattr(e, 'status_code', 0))
|
||||
if req.status_code < 200 or req.status_code >= 300:
|
||||
raise SupervisrApiError(req.content, status=req.status_code)
|
||||
raise PassbookApiError(req.content, status=req.status_code)
|
||||
return json.loads(req.content)
|
||||
|
||||
def get_user(self, access_token):
|
||||
return self._request('/api/core/v1/accounts/me/?format=openid', access_token)
|
||||
return self._request('/api/v1/openid/', access_token)
|
||||
|
|
Reference in a new issue