mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 15:32:38 -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
|
@ -8,7 +8,7 @@ from urllib.parse import unquote, urlparse
|
|||
_url.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.
|
||||
|
@ -26,7 +26,7 @@ limitations under the License.
|
|||
__all__ = ["parse_url", "get_proxy_info"]
|
||||
|
||||
|
||||
def parse_url(url):
|
||||
def parse_url(url: str) -> tuple:
|
||||
"""
|
||||
parse url and the result is tuple of
|
||||
(hostname, port, resource path and the flag of secure mode)
|
||||
|
@ -75,7 +75,7 @@ def parse_url(url):
|
|||
DEFAULT_NO_PROXY_HOST = ["localhost", "127.0.0.1"]
|
||||
|
||||
|
||||
def _is_ip_address(addr):
|
||||
def _is_ip_address(addr: str) -> bool:
|
||||
try:
|
||||
socket.inet_aton(addr)
|
||||
except socket.error:
|
||||
|
@ -84,7 +84,7 @@ def _is_ip_address(addr):
|
|||
return True
|
||||
|
||||
|
||||
def _is_subnet_address(hostname):
|
||||
def _is_subnet_address(hostname: str) -> bool:
|
||||
try:
|
||||
addr, netmask = hostname.split("/")
|
||||
return _is_ip_address(addr) and 0 <= int(netmask) < 32
|
||||
|
@ -92,7 +92,7 @@ def _is_subnet_address(hostname):
|
|||
return False
|
||||
|
||||
|
||||
def _is_address_in_network(ip, net):
|
||||
def _is_address_in_network(ip: str, net: str) -> bool:
|
||||
ipaddr = struct.unpack('!I', socket.inet_aton(ip))[0]
|
||||
netaddr, netmask = net.split('/')
|
||||
netaddr = struct.unpack('!I', socket.inet_aton(netaddr))[0]
|
||||
|
@ -101,7 +101,7 @@ def _is_address_in_network(ip, net):
|
|||
return ipaddr & netmask == netaddr
|
||||
|
||||
|
||||
def _is_no_proxy_host(hostname, no_proxy):
|
||||
def _is_no_proxy_host(hostname: str, no_proxy: list) -> bool:
|
||||
if not no_proxy:
|
||||
v = os.environ.get("no_proxy", os.environ.get("NO_PROXY", "")).replace(" ", "")
|
||||
if v:
|
||||
|
@ -122,8 +122,8 @@ def _is_no_proxy_host(hostname, no_proxy):
|
|||
|
||||
|
||||
def get_proxy_info(
|
||||
hostname, is_secure, proxy_host=None, proxy_port=0, proxy_auth=None,
|
||||
no_proxy=None, proxy_type='http'):
|
||||
hostname: str, is_secure: bool, proxy_host: str = None, proxy_port: int = 0, proxy_auth: tuple = None,
|
||||
no_proxy: list = None, proxy_type: str = 'http') -> tuple:
|
||||
"""
|
||||
Try to retrieve proxy host and port from environment
|
||||
if not provided in options.
|
||||
|
@ -137,14 +137,14 @@ def get_proxy_info(
|
|||
Websocket server name.
|
||||
is_secure: bool
|
||||
Is the connection secure? (wss) looks for "https_proxy" in env
|
||||
before falling back to "http_proxy"
|
||||
instead of "http_proxy"
|
||||
proxy_host: str
|
||||
http proxy host name.
|
||||
http_proxy_port: str or int
|
||||
proxy_port: str or int
|
||||
http proxy port.
|
||||
http_no_proxy: list
|
||||
no_proxy: list
|
||||
Whitelisted host names that don't use the proxy.
|
||||
http_proxy_auth: tuple
|
||||
proxy_auth: tuple
|
||||
HTTP proxy auth information. Tuple of username and password. Default is None.
|
||||
proxy_type: str
|
||||
Specify the proxy protocol (http, socks4, socks4a, socks5, socks5h). Default is "http".
|
||||
|
@ -158,15 +158,11 @@ def get_proxy_info(
|
|||
auth = proxy_auth
|
||||
return proxy_host, port, auth
|
||||
|
||||
env_keys = ["http_proxy"]
|
||||
if is_secure:
|
||||
env_keys.insert(0, "https_proxy")
|
||||
|
||||
for key in env_keys:
|
||||
value = os.environ.get(key, os.environ.get(key.upper(), "")).replace(" ", "")
|
||||
if value:
|
||||
proxy = urlparse(value)
|
||||
auth = (unquote(proxy.username), unquote(proxy.password)) if proxy.username else None
|
||||
return proxy.hostname, proxy.port, auth
|
||||
env_key = "https_proxy" if is_secure else "http_proxy"
|
||||
value = os.environ.get(env_key, os.environ.get(env_key.upper(), "")).replace(" ", "")
|
||||
if value:
|
||||
proxy = urlparse(value)
|
||||
auth = (unquote(proxy.username), unquote(proxy.password)) if proxy.username else None
|
||||
return proxy.hostname, proxy.port, auth
|
||||
|
||||
return None, 0, None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue