import sys
from wyze_sdk import Client
from wyze_sdk.errors import WyzeApiError
# Enable debug logging
import logging
logging.basicConfig(level=logging.DEBUG)
try:
client = Client(token='access_token',
refresh_token='refresh_token)
api_response = client.api_test()
list_of_cameras = client.cameras.list()
except WyzeApiError as e:
# You will get a WyzeApiError if the request failed
print(f"Got an error: {e}")
is leading into this exception:
DEBUG:wyze_sdk.service.base:merging request-specific headers into session headers
DEBUG:wyze_sdk.service.base:unmodified prepared request
DEBUG:wyze_sdk.service.base:<PreparedRequest [POST]>
INFO:wyze_sdk.service.base:requesting POST to https://api.wyzecam.com/api.test
DEBUG:wyze_sdk.service.base:headers: {'User-Agent': 'okhttp/4.7.2', 'Accept-Encoding': 'gzip', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Type': 'application/json;charset=utf-8', 'Content-Length': '1132'}
DEBUG:wyze_sdk.service.base:body: b'{"access_token":"access_token}'
DEBUG:wyze_sdk.service.base:settings: {'proxies': OrderedDict(), 'stream': False, 'verify': True, 'cert': None}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.wyzecam.com:443
DEBUG:urllib3.connectionpool:https://api.wyzecam.com:443 "POST /api.test HTTP/1.1" 404 681
Traceback (most recent call last):
File "/home/user/PycharmProjects/WyzeAPI/main.py", line 26, in <module>
api_response = client.api_test()
File "/home/user/PycharmProjects/WyzeAPI/.venv/lib/python3.13/site-packages/wyze_sdk/api/client.py", line 273, in api_test
return self._api_client().api_call(api_method, http_verb=http_verb, json=kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/PycharmProjects/WyzeAPI/.venv/lib/python3.13/site-packages/wyze_sdk/service/api_service.py", line 66, in api_call
return super().api_call(api_method, http_verb=http_verb, data=None, params=None, json=json, headers=headers, auth=None)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/PycharmProjects/WyzeAPI/.venv/lib/python3.13/site-packages/wyze_sdk/service/base.py", line 204, in api_call
return self.do_post(url=api_url, headers=headers, payload=json, params=params, method=http_verb)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/PycharmProjects/WyzeAPI/.venv/lib/python3.13/site-packages/wyze_sdk/service/base.py", line 132, in do_post
return self._do_request(client, req)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/home/user/PycharmProjects/WyzeAPI/.venv/lib/python3.13/site-packages/wyze_sdk/service/base.py", line 106, in _do_request
raise err
File "/home/user/PycharmProjects/WyzeAPI/.venv/lib/python3.13/site-packages/wyze_sdk/service/base.py", line 93, in _do_request
response.raise_for_status()
~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/home/user/PycharmProjects/WyzeAPI/.venv/lib/python3.13/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.wyzecam.com/api.test
I have obtained the access & the refresh token via this method:
now below code:
is leading into this exception: