Skip to content

Commit 078c7f4

Browse files
committed
Refatoring for v2
1 parent c7dee30 commit 078c7f4

File tree

14 files changed

+469
-338
lines changed

14 files changed

+469
-338
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
with:
2525
python-version: "3.x"
2626
cache: "pip"
27-
cache-dependency-path: "requirements.txt"
28-
- run: python -m pip install -r requirements.txt
27+
cache-dependency-path: ".github/workflows/linter-requirements.txt"
28+
- run: python -m pip install -r .github/workflows/linter-requirements.txt
2929
- run: ${{ matrix.lint-command }}
3030

3131
dist:
File renamed without changes.

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,34 @@ python3 -m pip install ssdp
1414
## Usage
1515

1616
```python
17+
import ssdp.asyncio
18+
import ssdp.messages
1719
import asyncio
1820
import socket
1921

2022
import ssdp
2123

2224

23-
class MyProtocol(ssdp.SimpleServiceDiscoveryProtocol):
25+
class MyProtocol(ssdp.asyncio.SimpleServiceDiscoveryProtocol):
2426

25-
def response_received(self, response, addr):
26-
print(response, addr)
27+
def response_received(self, response, addr):
28+
print(response, addr)
2729

28-
def request_received(self, request, addr):
29-
print(request, addr)
30+
def request_received(self, request, addr):
31+
print(request, addr)
3032

3133

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

36-
notify = ssdp.SSDPRequest('NOTIFY')
38+
notify = ssdp.message.SSDPRequest('NOTIFY')
3739
notify.sendto(transport, (MyProtocol.MULTICAST_ADDRESS, 1982))
3840

3941
try:
40-
loop.run_forever()
42+
loop.run_forever()
4143
except KeyboardInterrupt:
42-
pass
44+
pass
4345

4446
transport.close()
4547
loop.close()

examples/request_msearch.py

Lines changed: 0 additions & 68 deletions
This file was deleted.

examples/respond_msearch.py

Lines changed: 0 additions & 78 deletions
This file was deleted.

pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ test = [
3737
"pytest",
3838
"pytest-cov",
3939
]
40+
cli = [
41+
"click",
42+
"Pygments",
43+
]
44+
45+
[project.scripts]
46+
ssdp = "ssdp:__main__.cli"
47+
48+
[project.entry-points."pygments.lexers"]
49+
ssdp = "ssdp.lexer:SSDPLexer"
4050

4151
[project.urls]
4252
Project-URL = "https://github.com/codingjoe/ssdp"

0 commit comments

Comments
 (0)