python-linkplay 0.0.7__tar.gz → 0.0.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/PKG-INFO +2 -1
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/setup.cfg +1 -0
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/src/linkplay/__main__.py +2 -2
- python_linkplay-0.0.8/src/linkplay/__version__.py +1 -0
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/src/linkplay/utils.py +25 -4
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/src/python_linkplay.egg-info/PKG-INFO +2 -1
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/src/python_linkplay.egg-info/requires.txt +1 -0
- python_linkplay-0.0.7/src/linkplay/__version__.py +0 -1
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/LICENSE +0 -0
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/README.md +0 -0
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/pyproject.toml +0 -0
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/setup.py +0 -0
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/src/linkplay/__init__.py +0 -0
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/src/linkplay/bridge.py +0 -0
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/src/linkplay/consts.py +0 -0
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/src/linkplay/controller.py +0 -0
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/src/linkplay/discovery.py +0 -0
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/src/linkplay/endpoint.py +0 -0
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/src/linkplay/exceptions.py +0 -0
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/src/python_linkplay.egg-info/SOURCES.txt +0 -0
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/src/python_linkplay.egg-info/dependency_links.txt +0 -0
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/src/python_linkplay.egg-info/not-zip-safe +0 -0
- {python_linkplay-0.0.7 → python_linkplay-0.0.8}/src/python_linkplay.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: python_linkplay
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.8
|
4
4
|
Summary: A Python Library for Seamless LinkPlay Device Control
|
5
5
|
Author: Velleman Group nv
|
6
6
|
License: MIT
|
@@ -13,6 +13,7 @@ Requires-Dist: aiohttp>=3.8.5
|
|
13
13
|
Requires-Dist: appdirs>=1.4.4
|
14
14
|
Requires-Dist: async_upnp_client>=0.36.2
|
15
15
|
Requires-Dist: deprecated>=1.2.14
|
16
|
+
Requires-Dist: aiofiles>=24.1.0
|
16
17
|
Provides-Extra: testing
|
17
18
|
Requires-Dist: pytest>=7.3.1; extra == "testing"
|
18
19
|
Requires-Dist: pytest-cov>=4.1.0; extra == "testing"
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import asyncio
|
2
2
|
|
3
3
|
from linkplay.controller import LinkPlayController
|
4
|
-
from linkplay.utils import
|
4
|
+
from linkplay.utils import async_create_unverified_client_session
|
5
5
|
|
6
6
|
|
7
7
|
async def main():
|
8
|
-
async with
|
8
|
+
async with await async_create_unverified_client_session() as session:
|
9
9
|
controller = LinkPlayController(session)
|
10
10
|
|
11
11
|
await controller.discover_bridges()
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = '0.0.8'
|
@@ -7,6 +7,7 @@ import ssl
|
|
7
7
|
from http import HTTPStatus
|
8
8
|
from typing import Dict
|
9
9
|
|
10
|
+
import aiofiles
|
10
11
|
import async_timeout
|
11
12
|
from aiohttp import ClientError, ClientSession, TCPConnector
|
12
13
|
from appdirs import AppDirs
|
@@ -86,12 +87,25 @@ def create_unverified_context() -> ssl.SSLContext:
|
|
86
87
|
with open(mtls_certificate_path, "w", encoding="utf-8") as file:
|
87
88
|
file.write(MTLS_CERTIFICATE_CONTENTS)
|
88
89
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
90
|
+
return create_ssl_context(path=mtls_certificate_path)
|
91
|
+
|
92
|
+
|
93
|
+
async def async_create_unverified_context() -> ssl.SSLContext:
|
94
|
+
"""Asynchronously creates an unverified SSL context with the default mTLS certificate."""
|
95
|
+
async with aiofiles.tempfile.NamedTemporaryFile(
|
96
|
+
"w", encoding="utf-8"
|
97
|
+
) as mtls_certificate:
|
98
|
+
await mtls_certificate.write(MTLS_CERTIFICATE_CONTENTS)
|
99
|
+
await mtls_certificate.flush()
|
100
|
+
return create_ssl_context(path=str(mtls_certificate.name))
|
101
|
+
|
102
|
+
|
103
|
+
def create_ssl_context(path: str) -> ssl.SSLContext:
|
104
|
+
"""Creates an SSL context from given certificate file."""
|
105
|
+
sslcontext: ssl.SSLContext = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
93
106
|
sslcontext.check_hostname = False
|
94
107
|
sslcontext.verify_mode = ssl.CERT_NONE
|
108
|
+
sslcontext.load_cert_chain(certfile=path)
|
95
109
|
with contextlib.suppress(AttributeError):
|
96
110
|
# This only works for OpenSSL >= 1.0.0
|
97
111
|
sslcontext.options |= ssl.OP_NO_COMPRESSION
|
@@ -104,3 +118,10 @@ def create_unverified_client_session() -> ClientSession:
|
|
104
118
|
context: ssl.SSLContext = create_unverified_context()
|
105
119
|
connector: TCPConnector = TCPConnector(family=socket.AF_UNSPEC, ssl=context)
|
106
120
|
return ClientSession(connector=connector)
|
121
|
+
|
122
|
+
|
123
|
+
async def async_create_unverified_client_session() -> ClientSession:
|
124
|
+
"""Asynchronously creates a ClientSession using the default unverified SSL context"""
|
125
|
+
context: ssl.SSLContext = await async_create_unverified_context()
|
126
|
+
connector: TCPConnector = TCPConnector(family=socket.AF_UNSPEC, ssl=context)
|
127
|
+
return ClientSession(connector=connector)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: python_linkplay
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.8
|
4
4
|
Summary: A Python Library for Seamless LinkPlay Device Control
|
5
5
|
Author: Velleman Group nv
|
6
6
|
License: MIT
|
@@ -13,6 +13,7 @@ Requires-Dist: aiohttp>=3.8.5
|
|
13
13
|
Requires-Dist: appdirs>=1.4.4
|
14
14
|
Requires-Dist: async_upnp_client>=0.36.2
|
15
15
|
Requires-Dist: deprecated>=1.2.14
|
16
|
+
Requires-Dist: aiofiles>=24.1.0
|
16
17
|
Provides-Extra: testing
|
17
18
|
Requires-Dist: pytest>=7.3.1; extra == "testing"
|
18
19
|
Requires-Dist: pytest-cov>=4.1.0; extra == "testing"
|
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = '0.0.7'
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{python_linkplay-0.0.7 → python_linkplay-0.0.8}/src/python_linkplay.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|