mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 05:31:15 -07:00
Bump websocket-client from 1.6.2 to 1.7.0 (#2207)
* Bump websocket-client from 1.6.2 to 1.7.0 Bumps [websocket-client](https://github.com/websocket-client/websocket-client) from 1.6.2 to 1.7.0. - [Release notes](https://github.com/websocket-client/websocket-client/releases) - [Changelog](https://github.com/websocket-client/websocket-client/blob/master/ChangeLog) - [Commits](https://github.com/websocket-client/websocket-client/compare/v1.6.2...v1.7.0) --- updated-dependencies: - dependency-name: websocket-client dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update websocket-client==1.7.0 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
dbffb519f5
commit
24b6d37bbe
23 changed files with 1909 additions and 801 deletions
|
@ -1,6 +1,7 @@
|
|||
import errno
|
||||
import selectors
|
||||
import socket
|
||||
from typing import Union
|
||||
|
||||
from ._exceptions import *
|
||||
from ._ssl_compat import *
|
||||
|
@ -37,12 +38,18 @@ if hasattr(socket, "TCP_KEEPCNT"):
|
|||
|
||||
_default_timeout = None
|
||||
|
||||
__all__ = ["DEFAULT_SOCKET_OPTION", "sock_opt", "setdefaulttimeout", "getdefaulttimeout",
|
||||
"recv", "recv_line", "send"]
|
||||
__all__ = [
|
||||
"DEFAULT_SOCKET_OPTION",
|
||||
"sock_opt",
|
||||
"setdefaulttimeout",
|
||||
"getdefaulttimeout",
|
||||
"recv",
|
||||
"recv_line",
|
||||
"send",
|
||||
]
|
||||
|
||||
|
||||
class sock_opt:
|
||||
|
||||
def __init__(self, sockopt: list, sslopt: dict) -> None:
|
||||
if sockopt is None:
|
||||
sockopt = []
|
||||
|
@ -53,7 +60,7 @@ class sock_opt:
|
|||
self.timeout = None
|
||||
|
||||
|
||||
def setdefaulttimeout(timeout: int or float) -> None:
|
||||
def setdefaulttimeout(timeout: Union[int, float, None]) -> None:
|
||||
"""
|
||||
Set the global timeout setting to connect.
|
||||
|
||||
|
@ -66,7 +73,7 @@ def setdefaulttimeout(timeout: int or float) -> None:
|
|||
_default_timeout = timeout
|
||||
|
||||
|
||||
def getdefaulttimeout() -> int or float:
|
||||
def getdefaulttimeout() -> Union[int, float, None]:
|
||||
"""
|
||||
Get default timeout
|
||||
|
||||
|
@ -89,7 +96,7 @@ def recv(sock: socket.socket, bufsize: int) -> bytes:
|
|||
pass
|
||||
except socket.error as exc:
|
||||
error_code = extract_error_code(exc)
|
||||
if error_code != errno.EAGAIN and error_code != errno.EWOULDBLOCK:
|
||||
if error_code not in [errno.EAGAIN, errno.EWOULDBLOCK]:
|
||||
raise
|
||||
|
||||
sel = selectors.DefaultSelector()
|
||||
|
@ -113,14 +120,13 @@ def recv(sock: socket.socket, bufsize: int) -> bytes:
|
|||
raise WebSocketTimeoutException(message)
|
||||
except SSLError as e:
|
||||
message = extract_err_message(e)
|
||||
if isinstance(message, str) and 'timed out' in message:
|
||||
if isinstance(message, str) and "timed out" in message:
|
||||
raise WebSocketTimeoutException(message)
|
||||
else:
|
||||
raise
|
||||
|
||||
if not bytes_:
|
||||
raise WebSocketConnectionClosedException(
|
||||
"Connection to remote host was lost.")
|
||||
raise WebSocketConnectionClosedException("Connection to remote host was lost.")
|
||||
|
||||
return bytes_
|
||||
|
||||
|
@ -130,14 +136,14 @@ def recv_line(sock: socket.socket) -> bytes:
|
|||
while True:
|
||||
c = recv(sock, 1)
|
||||
line.append(c)
|
||||
if c == b'\n':
|
||||
if c == b"\n":
|
||||
break
|
||||
return b''.join(line)
|
||||
return b"".join(line)
|
||||
|
||||
|
||||
def send(sock: socket.socket, data: bytes) -> int:
|
||||
def send(sock: socket.socket, data: Union[bytes, str]) -> int:
|
||||
if isinstance(data, str):
|
||||
data = data.encode('utf-8')
|
||||
data = data.encode("utf-8")
|
||||
|
||||
if not sock:
|
||||
raise WebSocketConnectionClosedException("socket is already closed.")
|
||||
|
@ -151,7 +157,7 @@ def send(sock: socket.socket, data: bytes) -> int:
|
|||
error_code = extract_error_code(exc)
|
||||
if error_code is None:
|
||||
raise
|
||||
if error_code != errno.EAGAIN and error_code != errno.EWOULDBLOCK:
|
||||
if error_code not in [errno.EAGAIN, errno.EWOULDBLOCK]:
|
||||
raise
|
||||
|
||||
sel = selectors.DefaultSelector()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue