wyze_sdk.service package¶
Submodules¶
wyze_sdk.service.api_service module¶
- class wyze_sdk.service.api_service.ApiServiceClient(token: Optional[str] = None, base_url: Optional[str] = 'https://api.wyzecam.com/', app_name: str = 'com.hualai', sc: str = 'a626948714654991afd3c0dbd7cdb901')¶
Bases:
wyze_sdk.service.base.BaseServiceClient
Wyze api client is the wrapper on the requests to https://api.wyzecam.com
- SC = 'a626948714654991afd3c0dbd7cdb901'¶
- WYZE_API_URL = 'https://api.wyzecam.com/'¶
- WYZE_APP_NAME = 'com.hualai'¶
- api_call(api_method: str, *, http_verb: str = 'POST', json: dict = {}, headers: Optional[dict] = None) wyze_sdk.service.wyze_response.WyzeResponse ¶
Create a request and execute the API call to Wyze. Args:
- api_endpoint (str): The target Wyze API endpoint.
e.g. ‘/app/v2/home_page/get_object_list’
http_verb (str): HTTP Verb. e.g. ‘POST’ data: The body to attach to the request. If a dictionary is
provided, form-encoding will take place. e.g. {‘key1’: ‘value1’, ‘key2’: ‘value2’}
- params (dict): The URL parameters to append to the URL.
e.g. {‘key1’: ‘value1’, ‘key2’: ‘value2’}
- json (dict): JSON for the body to attach to the request
(if data is not specified). e.g. {‘key1’: ‘value1’, ‘key2’: ‘value2’}
headers (dict): Additional request headers auth (dict): A dictionary that consists of access_token and refresh_token
- Returns:
- (WyzeResponse)
The server’s response to an HTTP request. Data from the response can be accessed like a dict.
- Raises:
- WyzeApiError: The following Wyze API call failed:
‘/app/v2/home_page/get_object_list’.
- WyzeRequestError: JSON data can only be submitted as
POST requests.
- cancel_device_timer(*, mac: str, action_type: int, **kwargs) wyze_sdk.service.wyze_response.WyzeResponse ¶
- get_co_event_list(*, device_ids: Sequence[str] = [], begin: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, limit: Optional[int] = 20, order_by: Optional[int] = 2, **kwargs) wyze_sdk.service.wyze_response.WyzeResponse ¶
- get_device_group_timer(*, id: int, action_type: int, **kwargs) wyze_sdk.service.wyze_response.WyzeResponse ¶
- “data”: {
“action_value”: “1”, “delay_time”: 10800, “plan_execute_ts”: 1618169169544
},
- get_device_info(*, mac: str, model: str, **kwargs) wyze_sdk.service.wyze_response.WyzeResponse ¶
- get_device_list_property_list(*, device_ids: Sequence[str], target_pids: Sequence[str], **kwargs) wyze_sdk.service.wyze_response.WyzeResponse ¶
- get_device_property_list(*, mac: str, model: str, target_pids: Sequence[str] = [], **kwargs) wyze_sdk.service.wyze_response.WyzeResponse ¶
- get_device_timer(*, mac: str, action_type: int, **kwargs) wyze_sdk.service.wyze_response.WyzeResponse ¶
- “data”: {
“action_value”: “1”, “delay_time”: 10800, “plan_execute_ts”: 1618169169544
},
- get_event_list(*, device_ids: Sequence[str] = [], event_values: Union[wyze_sdk.models.events.EventAlarmType, Sequence[wyze_sdk.models.events.EventAlarmType]] = [], event_tags: Sequence[str] = [], event_type: str = '1', begin: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, limit: int = 20, order_by: int = 2, **kwargs) wyze_sdk.service.wyze_response.WyzeResponse ¶
- get_motion_event_list(*, device_ids: Sequence[str] = [], begin: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, limit: Optional[int] = 20, order_by: Optional[int] = 2, **kwargs) wyze_sdk.service.wyze_response.WyzeResponse ¶
- get_object_list(**kwargs) wyze_sdk.service.wyze_response.WyzeResponse ¶
- get_smoke_event_list(*, device_ids: Sequence[str] = [], begin: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, limit: Optional[int] = 20, order_by: Optional[int] = 2, **kwargs) wyze_sdk.service.wyze_response.WyzeResponse ¶
- get_sound_event_list(*, device_ids: Sequence[str] = [], begin: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, limit: Optional[int] = 20, order_by: Optional[int] = 2, **kwargs) wyze_sdk.service.wyze_response.WyzeResponse ¶
- get_user_info(**kwargs) wyze_sdk.service.wyze_response.WyzeResponse ¶
- get_v1_device_info(*, mac: str, **kwargs) wyze_sdk.service.wyze_response.WyzeResponse ¶
- logout(**kwargs) wyze_sdk.service.wyze_response.WyzeResponse ¶
- refresh_token(*, refresh_token: str, **kwargs) wyze_sdk.service.wyze_response.WyzeResponse ¶
- run_action(*, mac: str, action_key: str, action_params: Optional[dict] = {}, custom_string: Optional[str] = None, provider_key: str, **kwargs) wyze_sdk.service.wyze_response.WyzeResponse ¶
- run_action_list(*, actions: Union[dict[str, dict[str, DeviceProp]], Sequence[dict[str, dict[str, DeviceProp]]]], custom_string: Optional[str] = None, **kwargs) WyzeResponse ¶
- set_device_property(*, mac: str, model: str, pid: str, value: Any, **kwargs) wyze_sdk.service.wyze_response.WyzeResponse ¶
- set_device_timer(*, mac: str, delay_time: int, action_value: int, **kwargs) wyze_sdk.service.wyze_response.WyzeResponse ¶
action_value: 0=off, 1=on
See: com.HLApi.CloudAPI.CloudProtocol.deviceTimerSet
- set_read_state_list(*, events: dict[str, Sequence[str]], read_state: bool = True, **kwargs) WyzeResponse ¶
wyze_sdk.service.auth_service module¶
wyze_sdk.service.base module¶
- class wyze_sdk.service.base.BaseServiceClient(token: Optional[str] = None, base_url: Optional[str] = None, timeout: int = 30, headers: Optional[dict] = None, app_id: Optional[str] = '9319141212m2ik', app_name: Optional[str] = 'wyze', app_version: Optional[str] = '2.19.14', user_agent_prefix: Optional[str] = None, user_agent_suffix: Optional[str] = None, phone_id: Optional[str] = None, phone_type: Optional[int] = 2, request_verifier: Optional[wyze_sdk.signature.RequestVerifier] = None, logger: Optional[logging.Logger] = None)¶
Bases:
object
- WYZE_APP_ID = '9319141212m2ik'¶
- WYZE_APP_NAME = 'wyze'¶
- WYZE_APP_VERSION = '2.19.14'¶
- WYZE_PHONE_TYPE = 2¶
- api_call(api_endpoint: str, *, http_verb: str = 'POST', data: Optional[dict] = None, params: Optional[dict] = None, json: Optional[dict] = None, headers: Optional[dict] = None, auth: Optional[dict] = None) wyze_sdk.service.wyze_response.WyzeResponse ¶
Create a request and execute the API call to Wyze. Args:
- api_endpoint (str): The target Wyze API endpoint.
e.g. ‘/app/v2/home_page/get_object_list’
http_verb (str): HTTP Verb. e.g. ‘POST’ data: The body to attach to the request. If a dictionary is
provided, form-encoding will take place. e.g. {‘key1’: ‘value1’, ‘key2’: ‘value2’}
- params (dict): The URL parameters to append to the URL.
e.g. {‘key1’: ‘value1’, ‘key2’: ‘value2’}
- json (dict): JSON for the body to attach to the request
(if data is not specified). e.g. {‘key1’: ‘value1’, ‘key2’: ‘value2’}
headers (dict): Additional request headers auth (dict): A dictionary that consists of access_token and refresh_token
- Returns:
- (WyzeResponse)
The server’s response to an HTTP request. Data from the response can be accessed like a dict.
- Raises:
- WyzeApiError: The following Wyze API call failed:
‘/app/v2/home_page/get_object_list’.
- WyzeRequestError: JSON data can only be submitted as
POST requests.
- do_get(url: str, headers: dict, payload: dict) wyze_sdk.service.wyze_response.WyzeResponse ¶
- do_post(url: str, headers: dict, payload: dict, params: Optional[dict] = None) wyze_sdk.service.wyze_response.WyzeResponse ¶
- get_sorted_params(params: dict = {}) str ¶
- class wyze_sdk.service.base.ExServiceClient(token: Optional[str] = None, base_url: Optional[str] = 'https://api.wyzecam.com/', app_name: str = 'com.hualai', app_id: str = '9319141212m2ik', request_verifier: Optional[wyze_sdk.signature.RequestVerifier] = None)¶
Bases:
wyze_sdk.service.base.WpkNetServiceClient
ex service client is the wrapper for WpkWyzeExService.
- class wyze_sdk.service.base.SignatureServiceClient(token: Optional[str] = None, base_url: Optional[str] = 'https://api.wyzecam.com/', app_name: str = 'com.hualai', app_id: str = '9319141212m2ik', request_verifier: Optional[wyze_sdk.signature.RequestVerifier] = None)¶
Bases:
wyze_sdk.service.base.WpkNetServiceClient
signature service client is the wrapper for WpkWyzeSignatureService
- class wyze_sdk.service.base.WpkNetServiceClient(token: Optional[str] = None, base_url: Optional[str] = 'https://api.wyzecam.com/', app_name: str = 'com.hualai', app_id: str = '9319141212m2ik', request_verifier: Optional[wyze_sdk.signature.RequestVerifier] = None)¶
Bases:
wyze_sdk.service.base.BaseServiceClient
wpk net service client is the wrapper to newer Wyze services like WpkWyzeSignatureService and WpkWyzeExService.
- WYZE_APP_NAME = 'com.hualai'¶
- WYZE_SALTS = {'9319141212m2ik': 'wyze_app_secret_key_132', 'venp_4c30f812828de875': 'CVCSNoa0ALsNEpgKls6ybVTVOmGzFoiq'}¶
- api_call(api_method: str, *, http_verb: str = 'POST', params: Optional[dict] = None, json: Optional[dict] = None, headers: Optional[dict] = None, nonce: Optional[int] = None) wyze_sdk.service.wyze_response.WyzeResponse ¶
Create a request and execute the API call to Wyze. Args:
- api_endpoint (str): The target Wyze API endpoint.
e.g. ‘/app/v2/home_page/get_object_list’
http_verb (str): HTTP Verb. e.g. ‘POST’ data: The body to attach to the request. If a dictionary is
provided, form-encoding will take place. e.g. {‘key1’: ‘value1’, ‘key2’: ‘value2’}
- params (dict): The URL parameters to append to the URL.
e.g. {‘key1’: ‘value1’, ‘key2’: ‘value2’}
- json (dict): JSON for the body to attach to the request
(if data is not specified). e.g. {‘key1’: ‘value1’, ‘key2’: ‘value2’}
headers (dict): Additional request headers auth (dict): A dictionary that consists of access_token and refresh_token
- Returns:
- (WyzeResponse)
The server’s response to an HTTP request. Data from the response can be accessed like a dict.
- Raises:
- WyzeApiError: The following Wyze API call failed:
‘/app/v2/home_page/get_object_list’.
- WyzeRequestError: JSON data can only be submitted as
POST requests.
wyze_sdk.service.earth_service module¶
wyze_sdk.service.ford_service module¶
wyze_sdk.service.general_api_service module¶
wyze_sdk.service.platform_service module¶
wyze_sdk.service.scale_service module¶
wyze_sdk.service.venus_service module¶
wyze_sdk.service.wyze_response module¶
A Python module for interacting and consuming responses from Wyze.
- class wyze_sdk.service.wyze_response.WyzeResponse(*, client, http_verb: str, api_url: str, req_args: dict, data: Union[dict, bytes], headers: dict, status_code: int)¶
Bases:
object
A container of response data.
- Attributes:
- data (dict): The json-encoded content of the response. Along
with the headers and status code information.
- Methods:
validate: Check if the response from Wyze was successful. get: Retrieves any key from the response data.
- Note:
Any attributes or methods prefixed with _underscores are intended to be “private” internal use only. They may be changed or removed at any time.
- get(key, default=None)¶
Retrieves any key from the response data.
- Note:
This is implemented so users can reference the WyzeResponse object like a dictionary. e.g. response.get(“ok”, False)
- Returns:
The value from data or the specified default.
- validate()¶
Check if the response from Wyze was successful.
- Returns:
- (WyzeResponse)
This method returns it’s own object. e.g. ‘self’
- Raises:
WyzeApiError: The request to the Wyze API failed.