Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

An easy to use UPnP TR64 protocol library

Project description

This library supports the discovery of UPnP devices in the local network and let you execute actions on them if the device supports any. Also it contains a convenient way to execute TR64 protocol actions on routers or other network devices which supports TR64.

>>> results = simpletr64.discover()
>>> print(results[0])
LOC: http://192.168.178.1:49000/tr64desc.xml SRV: urn:dslforum-org:device:InternetGatewayDevice:1
...
>>> device = simpletr64.DeviceTR64(hostname=192.168.178.1, port=49000)
...
>>> device.execute("/upnp/control/hosts", "urn:dslforum-org:service:Hosts:1", "GetGenericHostEntry", NewIndex=1)
{'NewActive': '0', 'NewIPAddress': '192.168.0.23', 'NewMACAddress': '9C:20:7B:E7:FF:5F', 'NewInterfaceType':
    'Ethernet', 'NewHostName': 'Apple-TV', 'NewAddressSource': 'DHCP', 'NewLeaseTimeRemaining': '0'}

or even easier, execute:

>>> device = System("192.168.178.1")
>>> device.setupTR64Device("fritz.box")
>>> print(device.getSystemInfo().manufactureName)
"AVM"

On the command line:

$ upnp_tools discover

Features

  • Discovery of UPnP devices in the local network
  • Gathering of UPnP device information’s
  • Executing of UPnP actions
  • Authentication for username/password or password only
  • HTTP(S) proxy support
  • Unicode
  • Provides shell command ‘upnp_tools’ for all above

Installation

To install Simple TR64, simply:

$ pip install simpletr64

Documentation

Please, see the documentation here

Release History

1.0.6 (2016-01-24)

  • Fix error in upnp_tools when no command was given

1.0.5 (2016-01-15)

  • Adding the support for DNLA devices which announce some device definitions slightly differently
  • Moving all tools/ scripts into one “upnp_tools” script and move it to bin so it get installed into exe path

1.0.4 (2016-01-11)

  • Adding Fritz specific actions
  • Fix a bug with installing the package, thanks to Raphael Sobik

1.0.3 (2016-01-08)

  • Added timeout to any TR64 action
  • Added getSpecificAssociatedDeviceInfo in Wifi actions
  • Added setEnable to toggle the LAN/WAN/Wifi interface on/off
  • Added setSSID and setChannel to set these Wifi interface parameters accordingly
  • Added softwareUpdateAvailable
  • Added requestConnection and terminateConnection for a WAN connection
  • Added AVM Fritz Box product specific capabilities in new Fritz class
  • Fix reboot action
  • Fix all TR64 actions with bool results which were always True

1.0.2 (2016-01-06)

  • Added the ability to request the namespace for a TR64 action
  • Added interface ID’s to all actions in Lan, Wan and Wifi
  • Added a factory method to DeviceTR64 which takes an URL to the device definitions
  • Improved error handling on XML parsing problems of any content
  • Changed the declaration of getGenericAssociatedDeviceInfo for consistency reasons
  • Changed for all Wifi actions that the interface id is now optional
  • Changed all TR64 action classes to be a sub class of DeviceTR64
  • Fix an issue with relative URL’s in the device definition

1.0.1 (2016-01-04)

  • Added better error reporting
  • Added timeout to any network interaction
  • added the possibility to discover more than one service at the same time
  • fixed getHostDetailsByMACAddress()

1.0.0 (2016-01-02)

  • Birth!

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for simpleTR64, version 1.0.6
Filename, size File type Python version Upload date Hashes
Filename, size simpleTR64-1.0.6-py2.py3-none-any.whl (50.1 kB) File type Wheel Python version 2.7 Upload date Hashes View hashes
Filename, size simpleTR64-1.0.6.tar.gz (36.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page