-
Notifications
You must be signed in to change notification settings - Fork 409
/
oauth_error.py
50 lines (33 loc) · 997 Bytes
/
oauth_error.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from __future__ import absolute_import, division, print_function
import stripe
from stripe.api_resources.error_object import OAuthErrorObject
from stripe.error import StripeError
class OAuthError(StripeError):
def __init__(
self,
code,
description,
http_body=None,
http_status=None,
json_body=None,
headers=None,
):
super(OAuthError, self).__init__(
description, http_body, http_status, json_body, headers, code
)
def construct_error_object(self):
if self.json_body is None:
return None
return OAuthErrorObject.construct_from(self.json_body, stripe.api_key)
class InvalidClientError(OAuthError):
pass
class InvalidGrantError(OAuthError):
pass
class InvalidRequestError(OAuthError):
pass
class InvalidScopeError(OAuthError):
pass
class UnsupportedGrantTypeError(OAuthError):
pass
class UnsupportedResponseTypeError(OAuthError):
pass