MCPcopy Index your code
hub / github.com/andreikop/python-ws-discovery

github.com/andreikop/python-ws-discovery @v2.1.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.1.2 ↗ · + Follow
457 symbols 1,495 edges 37 files 78 documented · 17%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Documentation Status

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.

Extensive package documentation is available at ReadTheDocs.

Install from PyPI: pip install WSDiscovery.

Basic usage

A simple 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()[0])
    wsd.stop()

Development notes

To fix a bug or develop this package, it is recommended to use a virtual environment and set up a development environment. For example:

$ python3 -m venv venv
$ . venv/bin/activate
(venv) $ pip3 install -e .

Then you can call wsdiscover and wspublish from within this virtual environment. Any code changes to the package will be available and testable immediately.

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.

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.

See full list of contributors on the GitHub page.

Core symbols most depended-on inside this repo

jQuery
called by 44
docs/_static/jquery-3.4.1.js
isFunction
called by 40
docs/_static/jquery-3.4.1.js
m
called by 40
docs/_static/jquery.js
k
called by 39
docs/_static/jquery.js
join
called by 38
wsdiscovery/threaded.py
addElementWithText
called by 25
wsdiscovery/util.py
ve
called by 21
docs/_static/jquery.js
t
called by 21
docs/_static/jquery.js

Shape

Function 277
Method 162
Class 18

Languages

Python53%
TypeScript47%

Modules by API surface

docs/_static/jquery-3.4.1.js112 symbols
docs/_static/jquery.js83 symbols
wsdiscovery/threaded.py56 symbols
wsdiscovery/envelope.py32 symbols
wsdiscovery/util.py30 symbols
wsdiscovery/discovery.py19 symbols
wsdiscovery/service.py17 symbols
wsdiscovery/publishing.py11 symbols
wsdiscovery/actions/probematch.py11 symbols
wsdiscovery/udp.py9 symbols
wsdiscovery/daemon.py9 symbols
docs/_static/underscore-1.3.1.js8 symbols

For agents

$ claude mcp add python-ws-discovery \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact