shauntarves/wyze-sdk

Wyze Client Error: must provide email and password

Closed this issue · 1 comments

So I'm not sure what's wrong here. But I've set os variables for WYZE_EMAIL/PASSWORD and I can even print those OS Variables the exact same way the authentication examples calls then for the API call:

from dotenv import load_dotenv
import os

from wyze_sdk import Client

load_dotenv()
print(os.environ['WYZE_EMAIL'])
print(os.environ['WYZE_PASSWORD'])
response = Client().login(email=os.environ['WYZE_EMAIL'], password=os.environ['WYZE_PASSWORD'])
print(f"access token: {response['access_token']}")
print(f"refresh token: {response['refresh_token']}")

And when I run the script it prints out my email and password in the shell just fine.

but then this is the error I get:

Traceback (most recent call last): File "/home/ccasteel/wyze_Test/login.py", line 10, in <module> response = Client().login(email=os.environ['WYZE_EMAIL'], password=os.environ['WYZE_PASSWORD']) File "/home/ccasteel/.local/lib/python3.10/site-packages/wyze_sdk/api/client.py", line 59, in __init__ self.login() File "/home/ccasteel/.local/lib/python3.10/site-packages/wyze_sdk/api/client.py", line 137, in login raise WyzeClientConfigurationError("must provide email and password") wyze_sdk.errors.WyzeClientConfigurationError: must provide email and password

What am I doing wrong?

Hey @theotherguy2175, sorry for the problems. You might have an older version of the wyze-sdk package installed. I just made changes in v1.10.0 to support creating a new Client() without the email and password being provided. So, at this point, you have 2 options:

  1. [assuming that you're running on an older sdk package] upgrade your wyze library
  2. if you don't want to do that, just use this, older format:
client = Client(email=os.environ['WYZE_EMAIL'], password=os.environ['WYZE_PASSWORD'])
...

You can see how this changed in this PR: https://github.com/shauntarves/wyze-sdk/pull/116/files

Sorry for any problem this caused you!