androidtvremote2 0.1.1__tar.gz → 0.1.2__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.
- {androidtvremote2-0.1.1/src/androidtvremote2.egg-info → androidtvremote2-0.1.2}/PKG-INFO +1 -1
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/pyproject.toml +1 -1
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2/androidtv_remote.py +15 -9
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2/src/androidtvremote2.egg-info}/PKG-INFO +1 -1
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/LICENSE +0 -0
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/README.md +0 -0
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/setup.cfg +0 -0
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2/__init__.py +0 -0
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2/base.py +0 -0
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2/certificate_generator.py +0 -0
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2/const.py +0 -0
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2/exceptions.py +0 -0
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2/pairing.py +0 -0
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2/polo_pb2.py +0 -0
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2/polo_pb2.pyi +0 -0
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2/remote.py +0 -0
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2/remotemessage_pb2.py +0 -0
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2/remotemessage_pb2.pyi +0 -0
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2.egg-info/SOURCES.txt +0 -0
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2.egg-info/dependency_links.txt +0 -0
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2.egg-info/requires.txt +0 -0
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2.egg-info/top_level.txt +0 -0
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/demo.py +0 -0
- {androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/tests/test_androidtv_remote.py +0 -0
|
@@ -19,6 +19,14 @@ from .remote import RemoteProtocol
|
|
|
19
19
|
from .remotemessage_pb2 import RemoteDirection
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
def _load_cert_chain(certfile: str, keyfile: str) -> ssl.SSLContext:
|
|
23
|
+
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
|
24
|
+
ssl_context.check_hostname = False
|
|
25
|
+
ssl_context.verify_mode = ssl.VerifyMode.CERT_NONE
|
|
26
|
+
ssl_context.load_cert_chain(certfile, keyfile)
|
|
27
|
+
return ssl_context
|
|
28
|
+
|
|
29
|
+
|
|
22
30
|
class AndroidTVRemote:
|
|
23
31
|
"""Pairing and connecting to an Android TV for remotely sending commands to it."""
|
|
24
32
|
|
|
@@ -170,18 +178,16 @@ class AndroidTVRemote:
|
|
|
170
178
|
await out.write(key_pem.decode("utf-8"))
|
|
171
179
|
return True
|
|
172
180
|
|
|
173
|
-
def _create_ssl_context(self) -> ssl.SSLContext:
|
|
181
|
+
async def _create_ssl_context(self) -> ssl.SSLContext:
|
|
174
182
|
if self._ssl_context:
|
|
175
183
|
return self._ssl_context
|
|
176
|
-
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
|
177
|
-
ssl_context.check_hostname = False
|
|
178
|
-
ssl_context.verify_mode = ssl.VerifyMode.CERT_NONE
|
|
179
184
|
try:
|
|
180
|
-
ssl_context
|
|
185
|
+
ssl_context = await self._loop.run_in_executor(
|
|
186
|
+
None, _load_cert_chain, self._certfile, self._keyfile
|
|
187
|
+
)
|
|
181
188
|
except FileNotFoundError as exc:
|
|
182
189
|
LOGGER.debug("Missing certificate. Error: %s", exc)
|
|
183
190
|
raise InvalidAuth from exc
|
|
184
|
-
ssl_context.load_cert_chain(self._certfile, self._keyfile)
|
|
185
191
|
self._ssl_context = ssl_context
|
|
186
192
|
return self._ssl_context
|
|
187
193
|
|
|
@@ -192,7 +198,7 @@ class AndroidTVRemote:
|
|
|
192
198
|
:raises ConnectionClosed: if connection was lost while waiting for the remote to start.
|
|
193
199
|
:raises InvalidAuth: if pairing is needed first.
|
|
194
200
|
"""
|
|
195
|
-
ssl_context = self._create_ssl_context()
|
|
201
|
+
ssl_context = await self._create_ssl_context()
|
|
196
202
|
on_con_lost = self._loop.create_future()
|
|
197
203
|
on_remote_started = self._loop.create_future()
|
|
198
204
|
try:
|
|
@@ -297,7 +303,7 @@ class AndroidTVRemote:
|
|
|
297
303
|
|
|
298
304
|
:raises CannotConnect: if couldn't connect, e.g. invalid IP address.
|
|
299
305
|
"""
|
|
300
|
-
ssl_context = self._create_ssl_context()
|
|
306
|
+
ssl_context = await self._create_ssl_context()
|
|
301
307
|
try:
|
|
302
308
|
_, writer = await asyncio.open_connection(
|
|
303
309
|
self.host, self._pair_port, ssl=ssl_context
|
|
@@ -333,7 +339,7 @@ class AndroidTVRemote:
|
|
|
333
339
|
:raises ConnectionClosed: if connection was lost.
|
|
334
340
|
"""
|
|
335
341
|
self.disconnect()
|
|
336
|
-
ssl_context = self._create_ssl_context()
|
|
342
|
+
ssl_context = await self._create_ssl_context()
|
|
337
343
|
on_con_lost = self._loop.create_future()
|
|
338
344
|
try:
|
|
339
345
|
(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2/certificate_generator.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2/remotemessage_pb2.pyi
RENAMED
|
File without changes
|
|
File without changes
|
{androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2.egg-info/requires.txt
RENAMED
|
File without changes
|
{androidtvremote2-0.1.1 → androidtvremote2-0.1.2}/src/androidtvremote2.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|