# SSDPy: Python SSDP library ![Build](https://github.com/MoshiBin/ssdpy/workflows/Build/badge.svg) [![PyPI](https://img.shields.io/pypi/v/ssdpy)](https://pypi.org/project/ssdpy/) [![PyPI - Wheel](https://img.shields.io/pypi/wheel/ssdpy)](https://pypi.org/project/ssdpy/) ![GitHub](https://img.shields.io/github/license/MoshiBin/ssdpy) [![codecov](https://codecov.io/gh/MoshiBin/ssdpy/branch/master/graph/badge.svg)](https://codecov.io/gh/MoshiBin/ssdpy) [![Read the Docs](https://img.shields.io/readthedocs/ssdpy)](https://ssdpy.readthedocs.io/en/latest/)
SSDPy is a lightweight implementation of [SSDP](https://en.wikipedia.org/wiki/Simple_Service_Discovery_Protocol) (Simple Service Discovery Protocol). It is designed for ease of use and high compatibility with the protocol in real-life use. It supports both the IETF and UPnP versions of the protocol. You can read the [full documentation here](https://ssdpy.readthedocs.io/en/latest/).
## Example usage
Send an SSDP discover packet (M-SEARCH):
```python
>>> from ssdpy import SSDPClient
>>> client = SSDPClient()
>>> devices = client.m_search("ssdp:all")
>>> for device in devices:
... print(device.get("usn"))
uuid:Dell-Printer-1_0-dsi-secretariat::urn:schemas-upnp-org:service:PrintBasic:1
uuid:00000000-0000-0000-0200-00125A8A0960::urn:schemas-microsoft-com:nhed:presence:1
```
Send an SSDP NOTIFY packet, telling others about a service:
```python
>>> from ssdpy import SSDPServer
>>> server = SSDPServer("my-service-identifier")
>>> server.notify()
```
Start an SSDP server which responds to relevant M-SEARCHes:
```python
>>> from ssdpy import SSDPServer
>>> server = SSDPServer("my-service-identifier", device_type="my-device-type")
>>> server.serve_forever()
```
Then, from a client, M-SEARCH for our server:
```python
>>> from ssdpy import SSDPClient
>>> client = SSDPClient()
>>> devices = client.m_search("my-device-type")
>>> for device in devices:
... print(device.get("usn"))
my-service-identifier
```
## CLI utilities
SSDPy comes with two CLI utilities:
- ssdpy-server is a server that listens for M-SEARCHes and responds if they match its name.
- ssdpy-discover sends an M-SEARCH query and collects all responses.
## Release checklist
- Update `ssdpy/version.py` with new version name.
- Update `CHANGES.md`.
- Commit the changes, tag with version & push.
- Run `make release`.
## Links
* IETF draft of the protocl (still in use by some devices, e.g. redfish) [https://tools.ietf.org/html/draft-cai-ssdp-v1-03](https://tools.ietf.org/html/draft-cai-ssdp-v1-03)
* UPnP Device Architecture 1.1 [https://web.archive.org/web/20150905102426/http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf](https://web.archive.org/web/20150905102426/http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf)
* UPnP Device Architecture 2.0 [https://web.archive.org/web/20151107123618/http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v2.0.pdf](https://web.archive.org/web/20151107123618/http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v2.0.pdf)
Raw data
{
"_id": null,
"home_page": "https://github.com/MoshiBin/ssdpy",
"name": "ssdpy",
"maintainer": "",
"docs_url": null,
"requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,<4",
"maintainer_email": "",
"keywords": "",
"author": "Moshi Binyamini",
"author_email": "moshi@moshib.in",
"download_url": "https://files.pythonhosted.org/packages/e2/64/6d9f8f5a41964bdc1702c958d57c172146bfd0d0b25c09fee0112c7378fe/ssdpy-0.4.1.tar.gz",
"platform": "",
"description": "# SSDPy: Python SSDP library ![Build](https://github.com/MoshiBin/ssdpy/workflows/Build/badge.svg) [![PyPI](https://img.shields.io/pypi/v/ssdpy)](https://pypi.org/project/ssdpy/) [![PyPI - Wheel](https://img.shields.io/pypi/wheel/ssdpy)](https://pypi.org/project/ssdpy/) ![GitHub](https://img.shields.io/github/license/MoshiBin/ssdpy) [![codecov](https://codecov.io/gh/MoshiBin/ssdpy/branch/master/graph/badge.svg)](https://codecov.io/gh/MoshiBin/ssdpy) [![Read the Docs](https://img.shields.io/readthedocs/ssdpy)](https://ssdpy.readthedocs.io/en/latest/)\n\nSSDPy is a lightweight implementation of [SSDP](https://en.wikipedia.org/wiki/Simple_Service_Discovery_Protocol) (Simple Service Discovery Protocol). It is designed for ease of use and high compatibility with the protocol in real-life use. It supports both the IETF and UPnP versions of the protocol. You can read the [full documentation here](https://ssdpy.readthedocs.io/en/latest/).\n\n## Example usage\n\nSend an SSDP discover packet (M-SEARCH):\n\n```python\n>>> from ssdpy import SSDPClient\n>>> client = SSDPClient()\n>>> devices = client.m_search(\"ssdp:all\")\n>>> for device in devices:\n... print(device.get(\"usn\"))\nuuid:Dell-Printer-1_0-dsi-secretariat::urn:schemas-upnp-org:service:PrintBasic:1\nuuid:00000000-0000-0000-0200-00125A8A0960::urn:schemas-microsoft-com:nhed:presence:1\n```\n\nSend an SSDP NOTIFY packet, telling others about a service:\n\n```python\n>>> from ssdpy import SSDPServer\n>>> server = SSDPServer(\"my-service-identifier\")\n>>> server.notify()\n```\n\nStart an SSDP server which responds to relevant M-SEARCHes:\n\n```python\n>>> from ssdpy import SSDPServer\n>>> server = SSDPServer(\"my-service-identifier\", device_type=\"my-device-type\")\n>>> server.serve_forever()\n```\n\nThen, from a client, M-SEARCH for our server:\n\n```python\n>>> from ssdpy import SSDPClient\n>>> client = SSDPClient()\n>>> devices = client.m_search(\"my-device-type\")\n>>> for device in devices:\n... print(device.get(\"usn\"))\nmy-service-identifier\n```\n\n## CLI utilities\n\nSSDPy comes with two CLI utilities:\n\n- ssdpy-server is a server that listens for M-SEARCHes and responds if they match its name.\n- ssdpy-discover sends an M-SEARCH query and collects all responses.\n\n## Release checklist\n\n- Update `ssdpy/version.py` with new version name.\n- Update `CHANGES.md`.\n- Commit the changes, tag with version & push.\n- Run `make release`.\n\n## Links\n\n* IETF draft of the protocl (still in use by some devices, e.g. redfish) [https://tools.ietf.org/html/draft-cai-ssdp-v1-03](https://tools.ietf.org/html/draft-cai-ssdp-v1-03)\n* UPnP Device Architecture 1.1 [https://web.archive.org/web/20150905102426/http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf](https://web.archive.org/web/20150905102426/http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf)\n* UPnP Device Architecture 2.0 [https://web.archive.org/web/20151107123618/http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v2.0.pdf](https://web.archive.org/web/20151107123618/http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v2.0.pdf)\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python SSDP library",
"version": "0.4.1",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "790b0b95dfc0da20b9dd59fe9126605b",
"sha256": "f2a84915140a8df9d9432e35a487c8712fe23158d278f90f72ed5bd49fcf2bb5"
},
"downloads": -1,
"filename": "ssdpy-0.4.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "790b0b95dfc0da20b9dd59fe9126605b",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,<4",
"size": 14094,
"upload_time": "2020-12-07T13:21:44",
"upload_time_iso_8601": "2020-12-07T13:21:44.560247Z",
"url": "https://files.pythonhosted.org/packages/2a/76/b1cd35d235243fffe1c03876f217e60ed611ff8f6ddede2a6f61d575f98b/ssdpy-0.4.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "d092cd4b394f1160b59ded816675ca1a",
"sha256": "4971c6a010f77f147ecdbec9593f2d9187c3fb63658b0f5ec08f4c7be2387425"
},
"downloads": -1,
"filename": "ssdpy-0.4.1.tar.gz",
"has_sig": false,
"md5_digest": "d092cd4b394f1160b59ded816675ca1a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,<4",
"size": 10559,
"upload_time": "2020-12-07T13:21:46",
"upload_time_iso_8601": "2020-12-07T13:21:46.242029Z",
"url": "https://files.pythonhosted.org/packages/e2/64/6d9f8f5a41964bdc1702c958d57c172146bfd0d0b25c09fee0112c7378fe/ssdpy-0.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2020-12-07 13:21:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "MoshiBin",
"github_project": "ssdpy",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "ssdpy"
}