Git Product home page Git Product logo

python-ws-discovery's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-ws-discovery's Issues

Make TTL Configurable

Looking at the SOAP over UDP specification section 4.3, they recommend TTL be set to 1, which you are doing in this library. However, it would be nice to have this value configurable.

My use case is trying to discover ONVIF cameras, which use WS-Discovery, that are on a separate VLAN. The TTL value being set to 1 prevents the packet from making the hop over to the other VLAN.

What are your thoughts on bumping the TTL to 4 (the SSDP default), or at least making it configurable?

wsdiscover fails when wireguard vpn is running

Setup: ubuntu 18.04, wireguard vpn session active on udp port 51820 (wireguard default).

$ wsdiscover
Exception in thread Thread-1:
Traceback (most recent call last):   
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.6/dist-packages/wsdiscovery/threaded.py", line 150, in run
    self._sendPendingMessages()
  File "/usr/local/lib/python3.6/dist-packages/wsdiscovery/threaded.py", line 226, in _sendPendingMessages
    self._sendMsg(msg)
  File "/usr/local/lib/python3.6/dist-packages/wsdiscovery/threaded.py", line 213, in _sendMsg
    sock.sendto(data, (msg.getAddr(), msg.getPort()))
OSError: [Errno 126] Required key not available


Discovered:

$

Temporary fix near line 213 of threaded.py. When patched, good results are obtained even with vpn running.

        for sock in list(self._multiOutUniInSockets.values()):
            # hack to work with wireguard
            try:
                sock.sendto(data, (msg.getAddr(), msg.getPort()))
            except:
                pass
            if self._capture:

If the vpn session is stopped, then wsdiscover works without error.

Feature: Add IPv6 Support

I think the only change needed is to multicast to FF02::C instead of 239.255.255.250, and setup the socket to work with IPv6.

Ideally, I think support for both standards concurrently would be better than only attempting one.

module 'select' has no attribute 'poll'

I used the code in the example.
I'm runing it in windows10, and it's wrong:

Traceback (most recent call last):
  File "D:/PycharmProjects/ScoketDemo/UDP组播/test.py", line 13, in <module>
    wsd.start()
  File "C:\Python36\lib\site-packages\wsdiscovery\daemon.py", line 468, in start
    self._startThreads()
  File "C:\Python36\lib\site-packages\wsdiscovery\daemon.py", line 492, in _startThreads
    self._networkingThread = NetworkingThread(self)
  File "C:\Python36\lib\site-packages\wsdiscovery\daemon.py", line 97, in __init__
    self._poll = select.poll()
AttributeError: module 'select' has no attribute 'poll'

Python3 only?

Python2 is approaching end of life. How should WS-Discovery package approach that? Some options:

  • drop Python2 support in the next version?
  • introduce a new major version that's Python3 only?
  • continue supporting both?

Thoughts? I am thinking of doing more refactoring to make it easier to support asyncio, and adding some docs. Improving the package would of course overall be easier if we were able to drop Python2 support. So I'd prefer dropping it.

How about cutting a release from current master & making that the last release to support Python2?

OSError: [Errno 22] Invalid argument

Getting following when trying to run wsdiscover from the command line

Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/home/checkit/env2/lib/python3.10/site-packages/wsdiscovery/threaded.py", line 150, in run
self._sendPendingMessages()
File "/home/checkit/env2/lib/python3.10/site-packages/wsdiscovery/threaded.py", line 226, in _sendPendingMessages
self._sendMsg(msg)
File "/home/checkit/env2/lib/python3.10/site-packages/wsdiscovery/threaded.py", line 213, in _sendMsg
sock.sendto(data, (msg.getAddr(), msg.getPort()))
OSError: [Errno 22] Invalid argument

Discovered:

Refactor

Looks like the package could benefit from refactoring the code into several smaller modules?

Fix package metadata

The setup.py has the following info:

  author='L.A. Fernando',
  author_email='[email protected]',
  url='https://github.com/hlamer/python-ws-discovery.git'

Is this correct? Who's this L.A. Fernando? Is the source of python-ws-discovery code originally from somewhere else?

This should be checked and if needed, fixed prior to publishing at PyPI.

probe.py getTypes missing

probe.py

from ..util import createSkelSoapMessage, getBodyEl, getHeaderEl, addElementWithText,
addTypes, addScopes, getDocAsString, getScopes

getTypes is missing

publish in PyPI

Probably good idea to switch to using setuptools prior to that... @hlamer, I am willing to contribute if you have time to accept pull requests? Or give me contrib rights?

Discovery fails when multicast group registration request is sent ahead of discovery request

This happens with several different vendor cameras with different onvif client stack. Discovery works fine once I stop sending the multicast group registration request (and associated DROP request). This registration request should be made optional (and not the default). Several other discovery stacks/tools that I checked out seem to not send this request.

self._multiInSocket.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, self._makeMreq(addr))
except socket.error: # see comments for setsockopt(.., socket.IP_ADD_MEMBERSHIP..

It's not clear from the specification if this is required or even recommended. Any insights would be appreciated.

OSError: [Errno 101] Network is unreachable

Hello I'm getting error OSError: [Errno 101] Network is unreachable when I run below code

from wsdiscovery.discovery import ThreadedWSDiscovery as WSDiscovery
wsd = WSDiscovery()
wsd.start()
services = wsd.searchServices()
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/home/ashish/anaconda3/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/home/ashish/.local/lib/python3.6/site-packages/wsdiscovery/threaded.py", line 150, in run
    self._sendPendingMessages()
  File "/home/ashish/.local/lib/python3.6/site-packages/wsdiscovery/threaded.py", line 226, in _sendPendingMessages
    self._sendMsg(msg)
  File "/home/ashish/.local/lib/python3.6/site-packages/wsdiscovery/threaded.py", line 213, in _sendMsg
    sock.sendto(data, (msg.getAddr(), msg.getPort()))
OSError: [Errno 101] Network is unreachable

but if I try to search directly like below, I'm able to get response

import socket
import struct
import sys

message = '<?xml version="1.0" encoding="UTF-8"?>\n<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsdd="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:dn="http://www.onvif.org/ver10/network/wsdl"><SOAP-ENV:Header><wsa:MessageID>urn:uuid:5eb52dba-1787-49f8-ab8b-4567327b23c6</wsa:MessageID><wsa:ReplyTo SOAP-ENV:mustUnderstand="true"><wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address></wsa:ReplyTo><wsa:To SOAP-ENV:mustUnderstand="true">urn:schemas-xmlsoap-org:ws:2005:04:discovery</wsa:To><wsa:Action SOAP-ENV:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe</wsa:Action></SOAP-ENV:Header><SOAP-ENV:Body><wsdd:Probe><wsdd:Types>dn:NetworkVideoTransmitter</wsdd:Types></wsdd:Probe></SOAP-ENV:Body></SOAP-ENV:Envelope>'
multicast_group = ('239.255.255.250', 3702)

# Create the datagram socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

# Set a timeout so the socket does not block indefinitely when trying
# to receive data.
sock.settimeout(5)

# Set the time-to-live for messages to 1 so they do not go past the
# local network segment.
#ttl = struct.pack('b', 1)
#sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, ttl)

try:

    # Send data to the multicast group
    print(multicast_group)
    sent = sock.sendto(message.encode("UTF-8"), multicast_group)

    # Look for responses from all recipients
    while True:
        print ('waiting to receive',file=sys.stderr)
        try:
            data, server = sock.recvfrom(2048)
        except socket.timeout:
            print ('timed out, no more responses',file=sys.stderr)
            break
        else:
            print ('received "%s" from %s' % (data, server),file=sys.stderr)

finally:
    print ('closing socket',file=sys.stderr)
    sock.close()

output is

waiting to receive
received "b'<?xml version="1.0" encoding="UTF-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:enc="http://www.w3.org/2003/05/soap-encoding" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:dn="http://www.onvif.org/ver10/network/wsdl" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tds="http://www.onvif.org/ver10/device/wsdl"><s:Header><wsa:MessageID>uuid:31d79a54-e297-2d18-6a57-f259d96f9b2f</wsa:MessageID><wsa:RelatesTo>urn:uuid:5eb52dba-1787-49f8-ab8b-4567327b23c6</wsa:RelatesTo><wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To><wsa:Action>http://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatches</wsa:Action></s:Header><s:Body><d:ProbeMatches><d:ProbeMatch><wsa:EndpointReference><wsa:Address>urn:uuid:ddaf00c9-33a2-63e9-e4ae-3ac651e662c5</wsa:Address></wsa:EndpointReference><d:Types>dn:NetworkVideoTransmitter tds:Device</d:Types><d:Scopes>onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/location/country/china onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/name/IP-Camera onvif://www.onvif.org/hardware/HI3518C onvif://www.onvif.org/Profile/T onvif://www.onvif.org/Profile/G onvif://www.onvif.org/Profile/C onvif://www.onvif.org/Profile/A</d:Scopes><d:XAddrs>http://172.20.10.4:10001/onvif/device_service</d:XAddrs><d:MetadataVersion>1</d:MetadataVersion></d:ProbeMatch></d:ProbeMatches></s:Body></s:Envelope>'" from ('192.168.1.106', 3702)
waiting to receive
timed out, no more responses
closing socket

Memory leaks

Version 2.0.0 use in production ran into memory leaks because thread are not closed correctly. The patch 368a65d correctly fix this issue.

Can you release 2.0.1 on Pypi to provided the latest version with pip.

Probe match is NOT been sent in 3702 Port

I am trying to discover a device. Probe match is been sent without any issue , but I see it is been sent in 60979 or any other random port. Is there any way, we can make Probematch to respond in 3702 Port to the probe request .

<SOAP-ENV:Fault> with a chinese camera (TP-LINK)

First of all, thanks for this awesome python library and the great work.

Now my question.

Don't we all just love cheap chinese camera brands?

Mine is a brand new tp-link IP cam. It is not discovered with python-ws-discovery, but digging a bit deeper, I can see that it's response is None'd in message.py around line 35:

if dom.getElementsByTagNameNS(NS_SOAPENV, "Fault"):
    return None

The essence of the SOAP message the camera returns is this:

<SOAP-ENV:Header><wsa:MessageID>urn:uuid:8837bd04-b6df-4e95-971e-1edc3062fc0a</wsa:MessageID>
<wsa:To SOAP-ENV:mustUnderstand="true">urn:schemas-xmlsoap-org:ws:2005:04:discovery</wsa:To>
<wsa:Action SOAP-ENV:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe</wsa:Action>
</SOAP-ENV:Header><SOAP-ENV:Body><SOAP-ENV:Fault><SOAP-ENV:Code><SOAP-ENV:Value>SOAP-ENV:Sender
</SOAP-ENV:Value><SOAP-ENV:Subcode><SOAP-ENV:Value>ter:InvalidArgVal</SOAP-ENV:Value></SOAP-ENV:Subcode>
</SOAP-ENV:Code><SOAP-ENV:Reason><SOAP-ENV:Text xml:lang="en">error</SOAP-ENV:Text></SOAP-ENV:Reason>
</SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

So there is not much information why this camera dislikes python-ws-discovery, or maybe that ter:InvalidArgVal is providing a clue?

Does anyone have any experience / clue of why this would happen or how I could "massage" the message sent to the camera in such a way that it starts not to diss python-ws-discovery? I am happy to do the debugging, if you just give me a clue how to proceed. :)

Camera not discovered because it uses the prober's message id for its response message id

I ran into a camera that did not show up when I ran the command line tool wsdiscover.

On further investigation I found that when the camera responds to the probe it uses the same uuid for messageID as that used in the probe! I don't think this is right but then again there is no absolute guarantee that uuid's will not clash. [I did mod the code to change the uuid and saw the response also had the change].

In the current code, in threaded.py, on line 181, commenting out the continue allows the camera to be discovered. A side effect is that the probe echo gets processed as a response and results in

WARNING:daemon:could not find handler for: _handle_probe

for that particular message.

The seen Ids are kept in _knownMessageIds which is "preloaded" with the Id of the probe message. At first I thought the fix could be just to prefix the address and port to the Id similar to what you do for the instanceId. But the preloaded value to the _knownMessageIds set has address of the destination (239.255.255.250) and the response has the address of the local interface, Thus they do not match and you still get the warning.

I don't have experience with many different cameras and this is the only one I saw this problem on. However, it can be successfully discovered by other tools.

The solution i envision is.

  • Don't bother with preloading _knownMessageIds.
  • Prefix address and port to messageId before adding to _knowMessageId (in case there are two of these cameras out there)
  • "continue" on any message that is not a probe type

Enable github pages / readthedocs documentation

@andreikop you need to enable this; I don't have permissions. This is needed so that the package docs will show up here, once #33 is merged.

Go to settings tab for the repo, and enable github pages. Make sure to select the option that uses docs from master branch's /doc directory.

netifaces not listed in setup.py requirements

And thus importing WSDiscovery fails unless netifaces is separately installed.

(onvif_py3) rambombp2015:onvif rambo$ pip install https://github.com/andreikop/python-ws-discovery/archive/master.zip
Collecting https://github.com/andreikop/python-ws-discovery/archive/master.zip
Downloading https://github.com/andreikop/python-ws-discovery/archive/master.zip
Installing collected packages: WSDiscovery
Running setup.py install for WSDiscovery ... done
Successfully installed WSDiscovery-0.2
(onvif_py3) rambombp2015:onvif rambo$ python onvif_discovery_test.py
Traceback (most recent call last):
File "onvif_discovery_test.py", line 1, in
from WSDiscovery import WSDiscovery
File "/Users/rambo/.virtualenvs/onvif_py3/lib/python3.6/site-packages/WSDiscovery.py", line 15, in
import netifaces
ModuleNotFoundError: No module named 'netifaces'
(onvif_py3) rambombp2015:onvif rambo$ pip install netifaces
Collecting netifaces
Using cached netifaces-0.10.5.tar.gz
Building wheels for collected packages: netifaces
Running setup.py bdist_wheel for netifaces ... done
Stored in directory: /Users/rambo/Library/Caches/pip/wheels/9f/40/bd/1f8e0f83e36399900d81bebfd7ece579931ced3a5d9383284b
Successfully built netifaces
Installing collected packages: netifaces
Successfully installed netifaces-0.10.5
(onvif_py3) rambombp2015:onvif rambo$ python onvif_discovery_test.py
urn:uuid:00071858-1858-6a40-5840-e06290e2667e:http://172.17.24.39/onvif/device_service
<WSDiscovery.Service object at 0x10be37fd0>
['http://172.17.24.39/onvif/device_service']
(onvif_py3) rambombp2015:onvif rambo$

could not specify interface

$ discover                                                         
ERROR:ws-discovery:no interface found; use one of: en0, eth0

My wifi card interface name is wlp2s0. How I can specify it?

 $ ip link                                                                        
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether 9c:b6:d0:8a:6d:cb brd ff:ff:ff:ff:ff:ff

set up travis-ci

Now that we've started adding tests, I'd suggest we set up CI for this package at https://travis-ci.org .

@andreikop can you create an account for yourself at travis & add python-ws-discovery there please? Or, if you add me as a repo owner here, I can do that. Either way.

Generic program name "discover"

The package creates a command simply named discover. Such a generic name is likely to cause conflict with other packages when added to a Linux distribution such as Debian. I suggest renaming the command to something less generic to avoid any such conflict from arising. For instance, using wsdiscover as a command name would avoid such problems at little loss in usability. Would you agree to rename the tool?

I note that currently, there is no such conflict in Debian on this particular name, but it is easier to rename things before they gain widespread use.

Unclosed sockets on exit

This library has not been updated in a bit; I'm not sure I'll get an answer. In the threaded discovery service, a selector is opened and sockets are shoved in as needed. However, those sockets are never closed when stopping the service

wsdiscover fails when wireguard is running

This seems to be the same problem as in #41.
I use python 3.10, and thus need netifaces-plus so I installed wsdiscovery from PR #51. I Hope it doesn't make this issue inappropriate.
It works like normal when I turn the VPN off.

pip show:

Name: WSDiscovery
Version: 2.0.2.dev0
Summary: WS-Discovery implementation for python
Home-page: https://github.com/andreikop/python-ws-discovery.git
Author: Andrei Kopats
Author-email: [email protected]
License: 
Location: /var/mnt/data/jacob/git/farm-animal-detection/farm-animal-detection-env/lib/python3.10/site-packages
Requires: click, netifaces-plus
Required-by: 

example in the python shell

Python 3.10.12 (main, Jun  8 2023, 00:00:00) [GCC 13.1.1 20230511 (Red Hat 13.1.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from wsdiscovery.discovery import ThreadedWSDiscovery as WSDiscovery
>>> wsd = WSDiscovery()
>>> wsd.start()
Fatal Python error: Segmentation fault

Thread 0x00007f655f5ac6c0 (most recent call first):
  File "/var/mnt/data/jacob/git/farm-animal-detection/farm-animal-detection-env/lib64/python3.10/site-packages/wsdiscovery/threaded.py", line 233 in _sendPendingMessages
  File "/var/mnt/data/jacob/git/farm-animal-detection/farm-animal-detection-env/lib64/python3.10/site-packages/wsdiscovery/threaded.py", line 154 in run
  File "/usr/lib64/python3.10/threading.py", line 1016 in _bootstrap_inner
  File "/usr/lib64/python3.10/threading.py", line 973 in _bootstrap

Current thread 0x00007f656d742740 (most recent call first):
  File "/var/mnt/data/jacob/git/farm-animal-detection/farm-animal-detection-env/lib64/python3.10/site-packages/wsdiscovery/util.py", line 250 in _getNetworkAddrs
  File "/var/mnt/data/jacob/git/farm-animal-detection/farm-animal-detection-env/lib64/python3.10/site-packages/wsdiscovery/threaded.py", line 57 in _updateAddrs
  File "/var/mnt/data/jacob/git/farm-animal-detection/farm-animal-detection-env/lib64/python3.10/site-packages/wsdiscovery/threaded.py", line 54 in __init__
  File "/var/mnt/data/jacob/git/farm-animal-detection/farm-animal-detection-env/lib64/python3.10/site-packages/wsdiscovery/threaded.py", line 278 in _startThreads
  File "/var/mnt/data/jacob/git/farm-animal-detection/farm-animal-detection-env/lib64/python3.10/site-packages/wsdiscovery/threaded.py", line 296 in start
  File "<stdin>", line 1 in <module>

Extension modules: _netifaces (total: 1)
[1]    76894 segmentation fault (core dumped)  python3.10

OSError: [Errno 48] Address already in use

I have a django project and one route where my function is called which searches for all ip cameras, but if I access this rout twice then the second time I get the following error

my function

def find(self):
    ips = list()
    for iface in netifaces.interfaces():
        if netifaces.AF_INET in netifaces.ifaddresses(iface):
            ips.append(netifaces.ifaddresses(iface)[netifaces.AF_INET][0]["addr"])
    scope = [".".join(ip.split(".")[:2]) for ip in ips]

    wsd = WSDiscovery()
    wsd.start()
    ret = wsd.searchServices()
    wsd.stop()
    onvif_services = [s for s in ret if str(s.getTypes()).find("onvif") >= 0]
    urls = [ip for s in onvif_services for ip in s.getXAddrs()]
    ips = [ip for url in urls for ip in re.findall(r"\d+\.\d+\.\d+\.\d+", url)]
    lst = [ip for ip in ips if any(ip.startswith(sp) for sp in scope)]
    return sorted(lst)

error

Traceback (most recent call last):
  File "/Users/macbook/Python-Proj/test/camera/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/Users/macbook/Python-Proj/test/camera/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/macbook/Python-Proj/test/camera/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/Users/macbook/Python-Proj/test/camera/lib/python3.9/site-packages/rest_framework/viewsets.py", line 125, in view
    return self.dispatch(request, *args, **kwargs)
  File "/Users/macbook/Python-Proj/test/camera/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/Users/macbook/Python-Proj/test/camera/lib/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/Users/macbook/Python-Proj/test/camera/lib/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/Users/macbook/Python-Proj/test/camera/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/Users/macbook/Python-Proj/test/camera/apps/Locations/views.py", line 54, in list
    all_cameras_ips = camera_finder.find()
  File "/Users/macbook/Python-Proj/test/camera/apps/Locations/service.py", line 19, in find
    wsd.start()
  File "/Users/macbook/Python-Proj/test/camera/lib/python3.9/site-packages/wsdiscovery/threaded.py", line 285, in start
    self._startThreads()
  File "/Users/macbook/Python-Proj/test/camera/lib/python3.9/site-packages/wsdiscovery/threaded.py", line 265, in _startThreads
    self._networkingThread.start()
  File "/Users/macbook/Python-Proj/test/camera/lib/python3.9/site-packages/wsdiscovery/threaded.py", line 239, in start
    self._multiInSocket = self._createMulticastInSocket()
  File "/Users/macbook/Python-Proj/test/camera/lib/python3.9/site-packages/wsdiscovery/threaded.py", line 109, in _createMulticastInSocket
    sock.bind(('', MULTICAST_PORT))
OSError: [Errno 48] Address already in use

object has no attribute 'data'

I ran the Basic usage code on the top page and received the following:

File "C:\Users\admin\anaconda3\lib\site-packages\wsdiscovery\message.py", line 51, in parseSOAPMessage
return parseHelloMessage(dom)
File "C:\Users\admin\anaconda3\lib\site-packages\wsdiscovery\actions\hello.py", line 78, in parseHelloMessage
env.setEPR(dom.getElementsByTagNameNS(NS_ADDRESSING, "Address")[0].firstChild.data.strip())
AttributeError: 'NoneType' object has no attribute 'data'

Does anyone have any hints? Thanks a lot.

Versions > 2.0

I've got a new Python3-only development version at:

https://github.com/koodaamo/python-ws-discovery

See the updated changes doc there, plus the actual package docs.

The simple probing test passes, and I was able to discover my IP cam as usual, so the discovery part is mostly working already. I have not yet tested the service publishing part though; something is likely missing there.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.