File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 9
9
import string
10
10
11
11
from dynaconf .utils .boxing import DynaBox
12
- from requests .exceptions import Timeout
12
+ from requests .exceptions import RequestException , Timeout
13
13
14
14
from manifester .helpers import (
15
15
fetch_paginated_data ,
@@ -35,8 +35,10 @@ def __init__(
35
35
if minimal_init :
36
36
if kwargs .get ("offline_token" ) is not None :
37
37
self .offline_token = kwargs .get ("offline_token" )
38
- else :
38
+ elif settings . get ( "offline_token" ) is not None :
39
39
self .offline_token = settings .get ("offline_token" )
40
+ else :
41
+ raise KeyError ("Offline token not defined." )
40
42
self .token_request_url = settings .get ("url" ).get ("token_request" )
41
43
self .allocations_url = settings .get ("url" ).get ("allocations" )
42
44
self ._access_token = None
@@ -113,6 +115,8 @@ def access_token(self):
113
115
cmd_args = [f"{ self .token_request_url } " ],
114
116
cmd_kwargs = token_request_data ,
115
117
).json ()
118
+ if "error" in token_data :
119
+ raise RequestException (f"{ token_data ['error' ]} : { token_data ['error_description' ]} " )
116
120
if self .is_mock :
117
121
self ._access_token = token_data .access_token
118
122
else :
You can’t perform that action at this time.
0 commit comments