TR-064 API¶
General usage¶
Create a client connection to the router:
import tr064
client = tr064.Client('username', 'password', 'http://192.168.178.1:49000')
res = client.InternetGatewayDevice.DeviceInfo.GetInfo()
print(res.NewManufacturerName)
Actions (functions) are executed by append device
, service
and action
to the client:
Client.DeviceName.ServiceName.ActionName(Arguments, ...)
If a service is offered multiple times, actions can be accessed by the zero-based square bracket operator:
Client.DeviceName.ServiceName[1].ActionName(Arguments, ...)
See more Examples.
Note
If services, actions or arguments contain a minus sign -
, it must be replaced with an underscore _
and vice versa.
API¶
Client¶
-
class
tr064.client.
Client
(username, password, base_url='https://192.168.178.1:49443')¶ TR-064 client.
Parameters: - username (str) – Username with access to router.
- password (str) – Passwort to access router.
- base_url (str) – URL to router.
Exceptions¶
TR-064 exceptions.
-
exception
tr064.exceptions.
TR064Exception
¶ TR-064 base exception.
-
exception
tr064.exceptions.
TR064UnknownDeviceException
¶ TR-064 unknown device exception.
-
exception
tr064.exceptions.
TR064UnknownServiceException
¶ TR-064 unknown service exception.
-
exception
tr064.exceptions.
TR064UnknownServiceIndexException
¶ TR-064 unknown service index exception.
-
exception
tr064.exceptions.
TR064UnknownActionException
¶ TR-064 unknown action exception.
-
exception
tr064.exceptions.
TR064UnknownArgumentException
¶ TR-064 unknown argument exception.
-
exception
tr064.exceptions.
TR064MissingArgumentException
¶ TR-064 missing argument exception.
Note
All following classes are never used directly! They are only documented for the sake of completeness.
Device¶
-
class
tr064.device.
Device
(xml, auth, base_url)¶ TR-064 device.
Parameters: - xml (lxml.etree.Element) – XML device element
- auth (HTTPBasicAuthHandler) – HTTPBasicAuthHandler object, e.g. HTTPDigestAuth
- base_url (str) – URL to router.
Service¶
-
class
tr064.service.
Service
(auth, base_url, service_type, service_id, scpdurl, control_url, event_sub_url)¶ TR-064 service.
Action¶
-
class
tr064.action.
Action
(xml, auth, base_url, name, service_type, service_id, control_url)¶ TR-064 action.
Parameters: - xml (lxml.etree.Element) – XML action element
- auth (HTTPBasicAuthHandler) – HTTPBasicAuthHandler object, e.g. HTTPDigestAuth
- base_url (str) – URL to router.
- name (str) – Action name
- service_type (str) – Service type
- service_id (str) – Service ID
- control_url (str) – Control URL