mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-08 06:00:51 -07:00
Bump websocket-client from 1.5.1 to 1.6.2 (#2122)
* Bump websocket-client from 1.5.1 to 1.6.2 Bumps [websocket-client](https://github.com/websocket-client/websocket-client) from 1.5.1 to 1.6.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.5.1...v1.6.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.6.2 --------- 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
c93f470371
commit
eac78a3047
22 changed files with 295 additions and 260 deletions
|
@ -4,7 +4,7 @@
|
|||
wsdump.py
|
||||
websocket - WebSocket client library for Python
|
||||
|
||||
Copyright 2022 engn33r
|
||||
Copyright 2023 engn33r
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -37,7 +37,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
def get_encoding():
|
||||
def get_encoding() -> str:
|
||||
encoding = getattr(sys.stdin, "encoding", "")
|
||||
if not encoding:
|
||||
return "utf-8"
|
||||
|
@ -51,7 +51,7 @@ ENCODING = get_encoding()
|
|||
|
||||
class VAction(argparse.Action):
|
||||
|
||||
def __call__(self, parser, args, values, option_string=None):
|
||||
def __call__(self, parser: argparse.Namespace, args: tuple, values: str, option_string: str = None) -> None:
|
||||
if values is None:
|
||||
values = "1"
|
||||
try:
|
||||
|
@ -61,7 +61,7 @@ class VAction(argparse.Action):
|
|||
setattr(args, self.dest, values)
|
||||
|
||||
|
||||
def parse_args():
|
||||
def parse_args() -> argparse.Namespace:
|
||||
parser = argparse.ArgumentParser(description="WebSocket Simple Dump Tool")
|
||||
parser.add_argument("url", metavar="ws_url",
|
||||
help="websocket url. ex. ws://echo.websocket.events/")
|
||||
|
@ -93,7 +93,7 @@ def parse_args():
|
|||
|
||||
class RawInput:
|
||||
|
||||
def raw_input(self, prompt):
|
||||
def raw_input(self, prompt: str = "") -> str:
|
||||
line = input(prompt)
|
||||
|
||||
if ENCODING and ENCODING != "utf-8" and not isinstance(line, str):
|
||||
|
@ -106,29 +106,29 @@ class RawInput:
|
|||
|
||||
class InteractiveConsole(RawInput, code.InteractiveConsole):
|
||||
|
||||
def write(self, data):
|
||||
def write(self, data: str) -> None:
|
||||
sys.stdout.write("\033[2K\033[E")
|
||||
# sys.stdout.write("\n")
|
||||
sys.stdout.write("\033[34m< " + data + "\033[39m")
|
||||
sys.stdout.write("\n> ")
|
||||
sys.stdout.flush()
|
||||
|
||||
def read(self):
|
||||
def read(self) -> str:
|
||||
return self.raw_input("> ")
|
||||
|
||||
|
||||
class NonInteractive(RawInput):
|
||||
|
||||
def write(self, data):
|
||||
def write(self, data: str) -> None:
|
||||
sys.stdout.write(data)
|
||||
sys.stdout.write("\n")
|
||||
sys.stdout.flush()
|
||||
|
||||
def read(self):
|
||||
def read(self) -> str:
|
||||
return self.raw_input("")
|
||||
|
||||
|
||||
def main():
|
||||
def main() -> None:
|
||||
start_time = time.time()
|
||||
args = parse_args()
|
||||
if args.verbose > 1:
|
||||
|
@ -154,25 +154,25 @@ def main():
|
|||
console = InteractiveConsole()
|
||||
print("Press Ctrl+C to quit")
|
||||
|
||||
def recv():
|
||||
def recv() -> tuple:
|
||||
try:
|
||||
frame = ws.recv_frame()
|
||||
except websocket.WebSocketException:
|
||||
return websocket.ABNF.OPCODE_CLOSE, None
|
||||
return websocket.ABNF.OPCODE_CLOSE, ""
|
||||
if not frame:
|
||||
raise websocket.WebSocketException("Not a valid frame %s" % frame)
|
||||
raise websocket.WebSocketException("Not a valid frame {frame}".format(frame=frame))
|
||||
elif frame.opcode in OPCODE_DATA:
|
||||
return frame.opcode, frame.data
|
||||
elif frame.opcode == websocket.ABNF.OPCODE_CLOSE:
|
||||
ws.send_close()
|
||||
return frame.opcode, None
|
||||
return frame.opcode, ""
|
||||
elif frame.opcode == websocket.ABNF.OPCODE_PING:
|
||||
ws.pong(frame.data)
|
||||
return frame.opcode, frame.data
|
||||
|
||||
return frame.opcode, frame.data
|
||||
|
||||
def recv_ws():
|
||||
def recv_ws() -> None:
|
||||
while True:
|
||||
opcode, data = recv()
|
||||
msg = None
|
||||
|
@ -193,7 +193,7 @@ def main():
|
|||
data = repr(data)
|
||||
|
||||
if args.verbose:
|
||||
msg = "%s: %s" % (websocket.ABNF.OPCODE_MAP.get(opcode), data)
|
||||
msg = "{opcode}: {data}".format(opcode=websocket.ABNF.OPCODE_MAP.get(opcode), data=data)
|
||||
else:
|
||||
msg = data
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue