diff options
author | azaugg <azaugg.github@gmail.com> | 2019-04-24 15:37:47 -0700 |
---|---|---|
committer | azaugg <azaugg.github@gmail.com> | 2019-04-24 15:37:47 -0700 |
commit | d3acf9fe643d8e82bcad42b0adfb7abb9efed0d4 (patch) | |
tree | 3c80db0faa0d030c370636fde5e7550d3a330acd | |
parent | 3c25814664fef5b78716ed8841123ed1c0d17824 (diff) | |
download | websocket-client-d3acf9fe643d8e82bcad42b0adfb7abb9efed0d4.tar.gz |
Pep8 fixes
-rw-r--r-- | websocket/_app.py | 7 | ||||
-rw-r--r-- | websocket/_exceptions.py | 1 | ||||
-rw-r--r-- | websocket/_handshake.py | 2 | ||||
-rw-r--r-- | websocket/_http.py | 3 | ||||
-rw-r--r-- | websocket/_utils.py | 1 |
5 files changed, 10 insertions, 4 deletions
diff --git a/websocket/_app.py b/websocket/_app.py index 81aa1fc..89f39db 100644 --- a/websocket/_app.py +++ b/websocket/_app.py @@ -42,7 +42,7 @@ __all__ = ["WebSocketApp"] class Dispatcher: def __init__(self, app, ping_timeout): - self.app = app + self.app = app self.ping_timeout = ping_timeout def read(self, sock, read_callback, check_callback): @@ -56,7 +56,7 @@ class Dispatcher: class SSLDispacther: def __init__(self, app, ping_timeout): - self.app = app + self.app = app self.ping_timeout = ping_timeout def read(self, sock, read_callback, check_callback): @@ -75,6 +75,7 @@ class SSLDispacther: r, w, e = select.select((sock, ), (), (), self.ping_timeout) return r + class WebSocketApp(object): """ Higher level of APIs are provided. @@ -179,7 +180,7 @@ class WebSocketApp(object): http_no_proxy=None, http_proxy_auth=None, skip_utf8_validation=False, host=None, origin=None, dispatcher=None, - suppress_origin = False, proxy_type=None): + suppress_origin=False, proxy_type=None): """ run event loop for WebSocket framework. This loop is infinite loop and is alive during websocket is available. diff --git a/websocket/_exceptions.py b/websocket/_exceptions.py index b7a61d3..2070790 100644 --- a/websocket/_exceptions.py +++ b/websocket/_exceptions.py @@ -80,6 +80,7 @@ class WebSocketBadStatusException(WebSocketException): self.status_code = status_code self.resp_headers = resp_headers + class WebSocketAddressException(WebSocketException): """ If the websocket address info cannot be found, this exception will be raised. diff --git a/websocket/_handshake.py b/websocket/_handshake.py index 809a8c9..e9786e1 100644 --- a/websocket/_handshake.py +++ b/websocket/_handshake.py @@ -85,6 +85,7 @@ def handshake(sock, hostname, port, resource, **options): return handshake_response(status, resp, subproto) + def _pack_hostname(hostname): # IPv6 address if ':' in hostname: @@ -160,6 +161,7 @@ def _get_resp_headers(sock, success_statuses=(101, 301, 302, 303)): raise WebSocketBadStatusException("Handshake status %d %s", status, status_message, resp_headers) return status, resp_headers + _HEADERS_TO_CHECK = { "upgrade": "websocket", "connection": "upgrade", diff --git a/websocket/_http.py b/websocket/_http.py index 5b9a26d..e52e0ee 100644 --- a/websocket/_http.py +++ b/websocket/_http.py @@ -64,6 +64,7 @@ class proxy_info(object): self.auth = None self.no_proxy = None + def _open_proxied_socket(url, options, proxy): hostname, port, resource, is_secure = parse_url(url) @@ -146,7 +147,7 @@ def _get_addrinfo_list(hostname, port, is_secure, proxy): pport = pport and pport or 80 # when running on windows 10, the getaddrinfo used above # returns a socktype 0. This generates an error exception: - #_on_error: exception Socket type must be stream or datagram, not 0 + # _on_error: exception Socket type must be stream or datagram, not 0 # Force the socket type to SOCK_STREAM addrinfo_list = socket.getaddrinfo(phost, pport, 0, socket.SOCK_STREAM, socket.SOL_TCP) return addrinfo_list, True, pauth diff --git a/websocket/_utils.py b/websocket/_utils.py index 8eddabf..32ee12e 100644 --- a/websocket/_utils.py +++ b/websocket/_utils.py @@ -32,6 +32,7 @@ class NoLock(object): def __exit__(self, exc_type, exc_value, traceback): pass + try: # If wsaccel is available we use compiled routines to validate UTF-8 # strings. |