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: 'GetMultipleHNAPs', payload: GetMultipleHNAPsPayload, *, check: bool =
True) GetMultipleHNAPsResponse¶ -
call_hnap(action: 'GetNetworkModeSettings', payload: GetNetworkModeSettingsPayload, *, check: bool =
True) GetNetworkModeSettingsResponse -
call_hnap(action: 'Login', payload: LoginPayload, *, check: bool =
True) LoginResponse -
call_hnap(action: 'SetMotoLagStatus', payload: SetMotoLagStatusPayload, *, check: bool =
True) SetMotoLagStatusResponse -
call_hnap(action: 'SetStatusLogSettings', payload: SetStatusLogSettingsPayload, *, check: bool =
True) SetStatusLogSettingsResponse -
call_hnap(action: 'SetStatusSecuritySettings', payload: SetStatusSecuritySettingsPayload | RebootPayload, *, check: bool =
True) SetStatusLogSettingsResponse -
call_hnap(action: 'GetHomeAddress' | 'GetHomeConnection' | 'GetMotoLagStatus' | 'GetMotoStatusConnectionInfo' | 'GetMotoStatusDownstreamChannelInfo' | 'GetMotoStatusLog' | 'GetMotoStatusLogXXX' | 'GetMotoStatusSecAccount' | 'GetMotoStatusSecXXX' | 'GetMotoStatusSoftware' | 'GetMotoStatusStartupSequence' | 'GetMotoStatusUpstreamChannelInfo' | 'GetMultipleHNAPs' | 'GetNetworkModeSettings' | 'Login' | 'Logout' | 'SetMotoLagStatus' | 'SetMotoStatusDSTargetFreq' | 'SetStatusLogSettings' | 'SetStatusSecuritySettings', payload: 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['GetHomeAddress' | 'GetHomeConnection' | 'GetMotoLagStatus' | 'GetMotoStatusConnectionInfo' | 'GetMotoStatusDownstreamChannelInfo' | 'GetMotoStatusLog' | 'GetMotoStatusLogXXX' | 'GetMotoStatusSecAccount' | 'GetMotoStatusSecXXX' | 'GetMotoStatusSoftware' | 'GetMotoStatusStartupSequence' | 'GetMotoStatusUpstreamChannelInfo'], *, check: bool =
True) GetMultipleHNAPsResponse¶ Call multiple HNAPs.
Equivalent to calling
call_hnapwith action'GetMultipleHNAPs'and the correct payload. Some actions must be called this way even if they are the only action.
-
call_hnap(action: 'GetMultipleHNAPs', payload: GetMultipleHNAPsPayload, *, check: bool =
- 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_AUTHheader.
- mb8611.utils.make_soap_action_uri(action: str) str¶
Return 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.
Typing utilities¶
- class mb8611.api.ClearLogPayload¶
- class mb8611.api.GetHomeAddressResponse¶
Network address information.
- 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¶