Skip to main content

Python asyncio library for Simple Service Discovery Protocol (SSDP).

Project description

version ci coverage license

Python asyncio library for Simple Service Discovery Protocol (SSDP).

SSDP is a UPnP sub standard. For more information see: https://en.wikipedia.org/wiki/Simple_Service_Discovery_Protocol

Setup

pip install ssdp

Usage

import asyncio
import ssdp


class MyProtocol(ssdp.SimpleServiceDiscoveryProtocol):

    def response_received(self, response, addr):
        print(response, addr)

    def request_received(self, request, addr):
        print(request, addr)


loop = asyncio.get_event_loop()
connect = loop.create_datagram_endpoint(MyProtocol, family=socket.AF_INET)
transport, protocol = loop.run_until_complete(connect)

notify = ssdp.SSDPRequest('NOTIFY')
notify.sendto(transport, (MyProtocol.MULTICAST_ADDRESS, 1982))

try:
    loop.run_forever()
except KeyboardInterrupt:
    pass

transport.close()
loop.close()

Project details


Download files

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

Source Distribution

ssdp-1.0.0.tar.gz (6.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page