File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -32,8 +32,15 @@ def __init__(
3232 self ,
3333 api_key : Optional [str ],
3434 ):
35- self .api_key = api_key
36- if not self .api_key or len (self .api_key ) == 0 :
35+ self .api_key = (
36+ api_key
37+ if api_key
38+ else os .environ .get (API_KEY_V2_ENV_NAME , API_KEY_V2_DEFAULT )
39+ )
40+ self .request_timeout = TIMEOUT_DEFAULT
41+ self .set_base_url (BASE_URL_DEFAULT )
42+ self .set_from_env ()
43+ if not self .api_key :
3744 raise MindeeApiV2Error (
3845 (
3946 f"Missing API key,"
@@ -42,9 +49,6 @@ def __init__(
4249 f"'{ API_KEY_V2_ENV_NAME } ' environment variable."
4350 )
4451 )
45- self .request_timeout = TIMEOUT_DEFAULT
46- self .set_base_url (BASE_URL_DEFAULT )
47- self .set_from_env ()
4852 self .url_root = f"{ self .base_url .rstrip ('/' )} "
4953
5054 @property
You can’t perform that action at this time.
0 commit comments