diff --git a/main/apiauth.py b/main/apiauth.py index db9bf14..4e3f761 100644 --- a/main/apiauth.py +++ b/main/apiauth.py @@ -17,12 +17,12 @@ def api_auth(): credentials['email'] = os.getenv('ACCESS_CONTROLLER_API_EMAIL') # prefer token, use password if token not provided - if token is not None: + if token: credentials['token'] = token - else: - if password is None: - raise ValueError('access_controller token or password not in env') + elif password: credentials['password'] = password + else: + raise ValueError('access_controller token or password not in env') zenpy_client = Zenpy(**credentials) zenpy_user: ZenpyUser = zenpy_client.users.search(email).values[0]