diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | websocket/__init__.py | 2 | ||||
-rw-r--r-- | websocket/_exceptions.py | 3 | ||||
-rw-r--r-- | websocket/_handshake.py | 2 |
5 files changed, 10 insertions, 4 deletions
@@ -1,6 +1,11 @@ ChangeLog ============ +- 0.55.0 + + - Add response headers in WebSocketBadStatusException (#501) + + - 0.54.0 - Change license from LGPL to BSD. @@ -3,7 +3,7 @@ import sys from setuptools import setup import pkg_resources -VERSION = "0.54.0" +VERSION = "0.55.0" NAME = "websocket_client" install_requires = ["six"] diff --git a/websocket/__init__.py b/websocket/__init__.py index b7c6fba..7c3154d 100644 --- a/websocket/__init__.py +++ b/websocket/__init__.py @@ -26,4 +26,4 @@ from ._exceptions import * from ._logging import * from ._socket import * -__version__ = "0.54.0" +__version__ = "0.55.0" diff --git a/websocket/_exceptions.py b/websocket/_exceptions.py index ee08880..b7a61d3 100644 --- a/websocket/_exceptions.py +++ b/websocket/_exceptions.py @@ -74,10 +74,11 @@ class WebSocketBadStatusException(WebSocketException): WebSocketBadStatusException will be raised when we get bad handshake status code. """ - def __init__(self, message, status_code, status_message=None): + def __init__(self, message, status_code, status_message=None, resp_headers=None): msg = message % (status_code, status_message) super(WebSocketBadStatusException, self).__init__(msg) self.status_code = status_code + self.resp_headers = resp_headers class WebSocketAddressException(WebSocketException): """ diff --git a/websocket/_handshake.py b/websocket/_handshake.py index cf3c559..809a8c9 100644 --- a/websocket/_handshake.py +++ b/websocket/_handshake.py @@ -157,7 +157,7 @@ def _get_handshake_headers(resource, host, port, options): def _get_resp_headers(sock, success_statuses=(101, 301, 302, 303)): status, resp_headers, status_message = read_headers(sock) if status not in success_statuses: - raise WebSocketBadStatusException("Handshake status %d %s", status, status_message) + raise WebSocketBadStatusException("Handshake status %d %s", status, status_message, resp_headers) return status, resp_headers _HEADERS_TO_CHECK = { |