mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-14 02:26:58 -07:00
Bump websocket-client from 1.2.3 to 1.3.2 (#1700)
* Bump websocket-client from 1.2.3 to 1.3.2 Bumps [websocket-client](https://github.com/websocket-client/websocket-client) from 1.2.3 to 1.3.2. - [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.2.3...v1.3.2) --- 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.3.2 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
67baf9a260
commit
d510e0f600
22 changed files with 251 additions and 205 deletions
|
@ -1,12 +1,17 @@
|
|||
"""
|
||||
import array
|
||||
import os
|
||||
import struct
|
||||
import sys
|
||||
|
||||
"""
|
||||
from ._exceptions import *
|
||||
from ._utils import validate_utf8
|
||||
from threading import Lock
|
||||
|
||||
"""
|
||||
_abnf.py
|
||||
websocket - WebSocket client library for Python
|
||||
|
||||
Copyright 2021 engn33r
|
||||
Copyright 2022 engn33r
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -20,14 +25,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
import array
|
||||
import os
|
||||
import struct
|
||||
import sys
|
||||
|
||||
from ._exceptions import *
|
||||
from ._utils import validate_utf8
|
||||
from threading import Lock
|
||||
|
||||
try:
|
||||
# If wsaccel is available, use compiled routines to mask data.
|
||||
|
@ -79,6 +76,8 @@ STATUS_POLICY_VIOLATION = 1008
|
|||
STATUS_MESSAGE_TOO_BIG = 1009
|
||||
STATUS_INVALID_EXTENSION = 1010
|
||||
STATUS_UNEXPECTED_CONDITION = 1011
|
||||
STATUS_SERVICE_RESTART = 1012
|
||||
STATUS_TRY_AGAIN_LATER = 1013
|
||||
STATUS_BAD_GATEWAY = 1014
|
||||
STATUS_TLS_HANDSHAKE_ERROR = 1015
|
||||
|
||||
|
@ -92,6 +91,8 @@ VALID_CLOSE_STATUS = (
|
|||
STATUS_MESSAGE_TOO_BIG,
|
||||
STATUS_INVALID_EXTENSION,
|
||||
STATUS_UNEXPECTED_CONDITION,
|
||||
STATUS_SERVICE_RESTART,
|
||||
STATUS_TRY_AGAIN_LATER,
|
||||
STATUS_BAD_GATEWAY,
|
||||
)
|
||||
|
||||
|
@ -146,7 +147,7 @@ class ABNF:
|
|||
self.data = data
|
||||
self.get_mask_key = os.urandom
|
||||
|
||||
def validate(self, skip_utf8_validation=False):
|
||||
def validate(self, skip_utf8_validation=False) -> None:
|
||||
"""
|
||||
Validate the ABNF frame.
|
||||
|
||||
|
@ -174,13 +175,13 @@ class ABNF:
|
|||
|
||||
code = 256 * self.data[0] + self.data[1]
|
||||
if not self._is_valid_close_status(code):
|
||||
raise WebSocketProtocolException("Invalid close opcode.")
|
||||
raise WebSocketProtocolException("Invalid close opcode %r", code)
|
||||
|
||||
@staticmethod
|
||||
def _is_valid_close_status(code):
|
||||
def _is_valid_close_status(code: int) -> bool:
|
||||
return code in VALID_CLOSE_STATUS or (3000 <= code < 5000)
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return "fin=" + str(self.fin) \
|
||||
+ " opcode=" + str(self.opcode) \
|
||||
+ " data=" + str(self.data)
|
||||
|
@ -206,7 +207,7 @@ class ABNF:
|
|||
# mask must be set if send data from client
|
||||
return ABNF(fin, 0, 0, 0, opcode, 1, data)
|
||||
|
||||
def format(self):
|
||||
def format(self) -> bytes:
|
||||
"""
|
||||
Format this object to string(byte array) to send data to server.
|
||||
"""
|
||||
|
@ -251,9 +252,9 @@ class ABNF:
|
|||
|
||||
Parameters
|
||||
----------
|
||||
mask_key: <type>
|
||||
4 byte string.
|
||||
data: <type>
|
||||
mask_key: bytes or str
|
||||
4 byte mask.
|
||||
data: bytes or str
|
||||
data to mask/unmask.
|
||||
"""
|
||||
if data is None:
|
||||
|
@ -286,7 +287,7 @@ class frame_buffer:
|
|||
self.length = None
|
||||
self.mask = None
|
||||
|
||||
def has_received_header(self):
|
||||
def has_received_header(self) -> bool:
|
||||
return self.header is None
|
||||
|
||||
def recv_header(self):
|
||||
|
@ -308,7 +309,7 @@ class frame_buffer:
|
|||
return False
|
||||
return self.header[frame_buffer._HEADER_MASK_INDEX]
|
||||
|
||||
def has_received_length(self):
|
||||
def has_received_length(self) -> bool:
|
||||
return self.length is None
|
||||
|
||||
def recv_length(self):
|
||||
|
@ -323,7 +324,7 @@ class frame_buffer:
|
|||
else:
|
||||
self.length = length_bits
|
||||
|
||||
def has_received_mask(self):
|
||||
def has_received_mask(self) -> bool:
|
||||
return self.mask is None
|
||||
|
||||
def recv_mask(self):
|
||||
|
@ -360,7 +361,7 @@ class frame_buffer:
|
|||
|
||||
return frame
|
||||
|
||||
def recv_strict(self, bufsize):
|
||||
def recv_strict(self, bufsize: int) -> bytes:
|
||||
shortage = bufsize - sum(map(len, self.recv_buffer))
|
||||
while shortage > 0:
|
||||
# Limit buffer size that we pass to socket.recv() to avoid
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue