WS-Discovery implementation for python
WS-Discovery in Python
This is WS-Discovery implementation for Python 3. It allows to both discover services and publish discoverable services. For Python 2 support, use the latest 1.x version of this package.
wsdiscover command-line client is provided for discovering WS-Discovery compliant devices and systems. Run
wsdiscover --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.discovery import ThreadedWSDiscovery as WSDiscovery from wsdiscovery.publishing import ThreadedWSPublishing as WSPublishing from wsdiscovery import QName, Scope # Define type, scope & address of service ttype1 = QName("http://www.onvif.org/ver10/device/wsdl", "Device") scope1 = Scope("onvif://www.onvif.org/Model") xAddr1 = "localhost:8080/abc" # Publish the service wsp = WSPublishing() wsp.start() wsp.publishService(types=[ttype1], scopes=[scope1], xAddrs=[xAddr1]) # Discover it (along with any other service out there) wsd = WSDiscovery() wsd.start() services = wsd.searchServices() for service in services: print(service.getEPR() + ":" + service.getXAddrs()) wsd.stop()
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.
Authors and maintaining
Original version created by L.A. Fernando.
Code was then forked and maintained by Andrei Kopats.
Python2 support fixes by Michael Leinartas.
Python3 port done by Pieter Jordaan.
Packaging, major refactoring & command-line clients and reStructuredText package documentation by Petri Savolainen.
- decoupled threaded networking from ws-discovery implementation
- refactored app-level discovery & publishing code into their own modules
- refactored message construction, serialization & deserialization
- added new
wspublishcommand-line client to publish a service
- added unicast discovery support to
- collected all namespaces in one module
- improved README example
- good documentation in reStructuredText with Sphinx
- removed Python 2 support code
- Refactoring & Python2 fixes
- Introduce automated Travis testing
- Fix packaging
- Add a simple command-line client (petri)
- Debugging support, including message capture (petri)
- Fix breakage caused by refactoring (petri)
- Simple tests (petri)
- Improved packaging (petri)
- Modularize & refactor (petri)
- Better Python2 support (mleinart)
- First release @pypi (petri)
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size WSDiscovery-2.0.0-py3-none-any.whl (31.3 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size WSDiscovery-2.0.0.tar.gz (23.5 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for WSDiscovery-2.0.0-py3-none-any.whl