Skip to main content

WS-Discovery implementation for python

Project description

WS-Discovery in Python

This is WS-Discovery implementation for Python 2 & 3. It allows to both discover services and publish discoverable services.

Authors and maintaining

Original version created by L.A. Fernando. Code was then forked and maintained by Andrei Kopats. Python3 port done by Pieter Jordaan. Packaging, major refactoring & command-line client by Petri Savolainen. Python2 support fixes by Michael Leinartas.

Usage

A simple discover command-line client is provided for discovering WS-Discovery compliant devices and systems. Run discover --help for usage instructions.

Here's an example of how to use the package in your Python code. The following code first publishes a service and then discovers it:

    from wsdiscovery import WSDiscovery, QName, Scope

    wsd = WSDiscovery()
    wsd.start()

    ttype = QName("abc", "def")

    ttype1 = QName("namespace", "myTestService")

    # Note: some devices scope services using onvif:// scheme, not http://
    scope1 = Scope("http://myscope")
    ttype2 = QName("namespace", "myOtherTestService_type1")
    scope2 = Scope("http://other_scope")

    xAddr = "localhost:8080/abc"
    wsd.publishService(types=[ttype], scopes=[scope2], xAddrs=[xAddr])

    #ret = wsd.searchServices(scopes=[scope1], timeout=10)
    ret = wsd.searchServices()

    for service in ret:
        print(service.getEPR() + ":" + service.getXAddrs()[0])

    wsd.stop()

Development state

This is not 100% complete and correct WS-Discovery implementation. It doesn't verify data received from the network. It may crash, and might contain security holes. No guarantees - test it carefully for your use case.

Changelog

1.1.2 (2019-01-01)

  • Refactoring & Python2 fixes
  • Introduce automated Travis testing

1.1.1 (2018-12-21)

  • Fix packaging

1.1.0 (2018-12-21)

  • Add a simple command-line client (petri)
  • Debugging support, including message capture (petri)
  • Fix breakage caused by refactoring (petri)
  • Simple tests (petri)

1.0.0 (2018-12-18)

  • Improved packaging (petri)
  • Modularize & refactor (petri)
  • Better Python2 support (mleinart)

0.2 (2017-05-19)

  • First release @pypi (petri)

Download files

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

Files for WSDiscovery, version 1.1.2
Filename, size File type Python version Upload date Hashes
Filename, size WSDiscovery-1.1.2-py2-none-any.whl (24.2 kB) File type Wheel Python version py2 Upload date Hashes View hashes
Filename, size WSDiscovery-1.1.2-py3-none-any.whl (24.2 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size WSDiscovery-1.1.2.tar.gz (17.7 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