Client¶
Client class.
- exception mb8611.client.CallHNAPError(response: GetHomeAddressResponse | GetMultipleHNAPsResponse | GetNetworkModeSettingsResponse | LoginResponse | SetMotoLagStatusResponse | SetStatusLogSettingsResponse | SetStatusSecuritySettingsResponse)¶
- class mb8611.client.Client(password: str, host: str = '192.168.100.1', username: str = 'admin')¶
Client implementation.
- call_hnap(action: Literal['GetMultipleHNAPs'], payload: GetMultipleHNAPsPayload, check: bool = True) GetMultipleHNAPsResponse ¶
- call_hnap(action: Literal['GetNetworkModeSettings'], payload: GetNetworkModeSettingsPayload, check: bool = True) GetNetworkModeSettingsResponse
- call_hnap(action: Literal['Login'], payload: LoginPayload, check: bool = True) LoginResponse
- call_hnap(action: Literal['SetMotoLagStatus'], payload: SetMotoLagStatusPayload, check: bool = True) SetMotoLagStatusResponse
- call_hnap(action: Literal['SetStatusLogSettings'], payload: SetStatusLogSettingsPayload, check: bool = True) SetStatusLogSettingsResponse
- call_hnap(action: Literal['SetStatusSecuritySettings'], payload: SetStatusSecuritySettingsPayload | RebootPayload, check: bool = True) SetStatusLogSettingsResponse
- call_hnap(action: Literal['GetHomeAddress', 'GetHomeConnection', 'GetMotoLagStatus', 'GetMotoStatusConnectionInfo', 'GetMotoStatusDownstreamChannelInfo', 'GetMotoStatusLog', 'GetMotoStatusLogXXX', 'GetMotoStatusSecAccount', 'GetMotoStatusSecXXX', 'GetMotoStatusSoftware', 'GetMotoStatusStartupSequence', 'GetMotoStatusUpstreamChannelInfo', 'GetMultipleHNAPs', 'GetNetworkModeSettings', 'Login', 'Logout', 'SetMotoLagStatus', 'SetMotoStatusDSTargetFreq', 'SetStatusLogSettings', 'SetStatusSecuritySettings'], payload: Literal[None] = None, check: bool = True) GetHomeAddressResponse | GetMultipleHNAPsResponse | GetNetworkModeSettingsResponse | LoginResponse | SetMotoLagStatusResponse | SetStatusLogSettingsResponse | SetStatusSecuritySettingsResponse
- call_hnap(action: str, payload: Any = None, check: bool = True) GetHomeAddressResponse | GetMultipleHNAPsResponse | GetNetworkModeSettingsResponse | LoginResponse | SetMotoLagStatusResponse | SetStatusLogSettingsResponse | SetStatusSecuritySettingsResponse
Invoke an action.
- call_multiple_hnaps(actions: Collection[Literal['GetHomeAddress', 'GetHomeConnection', 'GetMotoLagStatus', 'GetMotoStatusConnectionInfo', 'GetMotoStatusDownstreamChannelInfo', 'GetMotoStatusLog', 'GetMotoStatusLogXXX', 'GetMotoStatusSecAccount', 'GetMotoStatusSecXXX', 'GetMotoStatusSoftware', 'GetMotoStatusStartupSequence', 'GetMotoStatusUpstreamChannelInfo']], check: bool = True) GetMultipleHNAPsResponse ¶
Call multiple HNAPs. Equivalent to calling
call_hnap
with action'GetMultipleHNAPs'
and the correct payload. Some actions must be called this way even if they are the only action.
- login() None ¶
Login. This is 99% the same as what happens in a browser but is not fully correct.
- exception mb8611.client.LockedError¶
- exception mb8611.client.LoginFailed¶
Constants¶
Common constants.
- mb8611.constants.MUST_BE_CALLED_FROM_MULTIPLE: Final[set[Literal['GetHomeAddress', 'GetHomeConnection', 'GetMotoLagStatus', 'GetMotoStatusConnectionInfo', 'GetMotoStatusDownstreamChannelInfo', 'GetMotoStatusLog', 'GetMotoStatusLogXXX', 'GetMotoStatusSecAccount', 'GetMotoStatusSecXXX', 'GetMotoStatusSoftware', 'GetMotoStatusStartupSequence', 'GetMotoStatusUpstreamChannelInfo']]] = {'GetHomeAddress', 'GetHomeConnection', 'GetMotoLagStatus', 'GetMotoStatusConnectionInfo', 'GetMotoStatusDownstreamChannelInfo', 'GetMotoStatusLog', 'GetMotoStatusLogXXX', 'GetMotoStatusSecAccount', 'GetMotoStatusSecXXX', 'GetMotoStatusSoftware', 'GetMotoStatusStartupSequence', 'GetMotoStatusUpstreamChannelInfo'}¶
Actions that do not work without using GetMultipleHNAPs.
- mb8611.constants.ROW_DELIMITERS: Final[dict[str, str]] = {'MotoStatusLogList': '}-{'}¶
Delimiters used in encoded table strings, keyed by action.
- mb8611.constants.SHARED_HEADERS: Final[Mapping[str, str]] = {'accept': 'application/json', 'cache-control': 'no-cache', 'connection': 'keep-alive', 'content-type': 'application/json', 'x-requested-with': 'XMLHttpRequest'}¶
Common HTTP headers.
- mb8611.constants.TABLE_KEYS = ('MotoConnDownstreamChannel', 'MotoConnUpstreamChannel', 'MotoStatusLogList')¶
Keys that contain specially encoded lists to be displayed in tables.
Utilities¶
Utility functions.
- mb8611.utils.make_hnap_auth(action: str, private_key: str = 'withoutloginkey') str ¶
Create the value required for the
HNAP_AUTH
header.
- mb8611.utils.make_soap_action_uri(action: str) str ¶
Returns the SOAP action URI for the given action.
- mb8611.utils.parse_table_str(table_str: str, row_delimiter: str = '|+|') Iterator[Sequence[str]] ¶
Parse a string that represents a table displayed in the UI.
- mb8611.utils.setup_logging(debug: bool | None = False) None ¶
Shared function to enable logging.
Typing utilities¶
- class mb8611.api.ClearLogPayload¶
- class mb8611.api.GetHomeAddressResponse¶
Network address information.
- MotoHomeIpAddress: str¶
IPv4 address.
- MotoHomeIpv6Address: str¶
IPv6 address.
- MotoHomeMacAddress: str¶
MAC address.
- MotoHomeSfVer: str¶
Firmware version.
- class mb8611.api.GetMultipleHNAPsPayload¶
Multiple HNAPs payload.
- class mb8611.api.GetMultipleHNAPsResponse¶
Multiple HNAPs response.
- class mb8611.api.GetNetworkModeSettingsPayload¶
- class mb8611.api.GetNetworkModeSettingsResponse¶
Not used in cable-modem only models.
- class mb8611.api.LoginPayload¶
Login payload.
- class mb8611.api.LoginResponse¶
Login response.
- LoginResponse: _LoginResponseLoginResponse¶
Login response.
- class mb8611.api.RebootPayload¶
- class mb8611.api.SetMotoLagStatusPayload¶
Not used in cable-modem only models.
- class mb8611.api.SetMotoLagStatusResponse¶
- class mb8611.api.SetMotoStatusDSTargetFreqPayload¶
Not used in cable-modem only models.
- class mb8611.api.SetStatusLogSettingsPayload¶
- class mb8611.api.SetStatusLogSettingsResponse¶
- class mb8611.api.SetStatusSecuritySettingsPayload¶