commit python3-websocket-client for openSUSE:Factory
Hello community, here is the log from the commit of package python3-websocket-client for openSUSE:Factory checked in at 2016-04-30 23:31:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python3-websocket-client (Old) and /work/SRC/openSUSE:Factory/.python3-websocket-client.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python3-websocket-client" Changes: -------- --- /work/SRC/openSUSE:Factory/python3-websocket-client/python3-websocket-client.changes 2016-04-28 16:56:24.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python3-websocket-client.new/python3-websocket-client.changes 2016-04-30 23:31:54.000000000 +0200 @@ -1,0 +2,10 @@ +Tue Apr 12 04:42:10 UTC 2016 - arun@gmx.de + +- update to version 0.36.0: + * added support for using custom connection class (#235) + * use Named logger (#238) + * implement ping/pong timeout (#241) + * Corrects the syntax highlight code (#243) + * fixed failure to join thread before it is started (#242) + +------------------------------------------------------------------- Old: ---- websocket_client-0.35.0.tar.gz New: ---- websocket_client-0.36.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python3-websocket-client.spec ++++++ --- /var/tmp/diff_new_pack.irRTwO/_old 2016-04-30 23:31:55.000000000 +0200 +++ /var/tmp/diff_new_pack.irRTwO/_new 2016-04-30 23:31:55.000000000 +0200 @@ -16,7 +16,7 @@ # Name: python3-websocket-client -Version: 0.35.0 +Version: 0.36.0 Release: 0 Summary: WebSocket client implementation License: LGPL-2.1 ++++++ websocket_client-0.35.0.tar.gz -> websocket_client-0.36.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.35.0/ChangeLog new/websocket_client-0.36.0/ChangeLog --- old/websocket_client-0.35.0/ChangeLog 2016-01-04 09:04:27.000000000 +0100 +++ new/websocket_client-0.36.0/ChangeLog 2016-04-12 02:00:24.000000000 +0200 @@ -1,6 +1,13 @@ ChangeLog ============ +- 0.36.0 + - added support for using custom connection class (#235) + - use Named logger (#238) + - implement ping/pong timeout (#241) + - Corrects the syntax highlight code (#243) + - fixed failure to join thread before it is started (#242) + - 0.35.0 - Prints timings in console (#217) - use inspect.getfullargspec with Python 3.x (#219) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.35.0/PKG-INFO new/websocket_client-0.36.0/PKG-INFO --- old/websocket_client-0.35.0/PKG-INFO 2016-01-04 09:05:17.000000000 +0100 +++ new/websocket_client-0.36.0/PKG-INFO 2016-04-12 02:02:42.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: websocket_client -Version: 0.35.0 +Version: 0.36.0 Summary: WebSocket client for python. hybi13 is supported. Home-page: https://github.com/liris/websocket-client Author: liris @@ -51,7 +51,9 @@ Current implementation of websocket-client is using "CONNECT" method via proxy. - example:: + example + + .. code:: python import websocket ws = websocket.WebSocket() @@ -63,7 +65,9 @@ Example ============= - Low Level API example:: + Low Level API example + + .. code:: python from websocket import create_connection ws = create_connection("ws://echo.websocket.org/") @@ -77,14 +81,33 @@ If you want to customize socket options, set sockopt. - sockopt example:: + sockopt example + + .. code:: python from websocket import create_connection ws = create_connection("ws://echo.websocket.org/", sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY),)) + You can also use your own class for the connection. + + custom connection class example + + ..code:: python + + from websocket import create_connection, WebSocket + class MyWebSocket(WebSocket): + def recv_frame(self): + frame = super().recv_frame() + print('yay! I got this frame: ', frame) + return frame + + ws = create_connection("ws://echo.websocket.org/", + sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY),), class_=MyWebSocket) + + JavaScript websocket-like API example - JavaScript websocket-like API example:: + .. code:: python import websocket import thread @@ -128,17 +151,23 @@ Please set sslopt to {"cert_reqs": ssl.CERT_NONE}. - WebSocketApp sample:: + WebSocketApp sample + + .. code:: python ws = websocket.WebSocketApp("wss://echo.websocket.org") ws.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE}) - create_connection sample:: + create_connection sample + + .. code:: python ws = websocket.create_connection("wss://echo.websocket.org", sslopt={"cert_reqs": ssl.CERT_NONE}) - WebSocket sample:: + WebSocket sample + + .. code:: python ws = websocket.WebSocket(sslopt={"cert_reqs": ssl.CERT_NONE}) ws.connect("wss://echo.websocket.org") @@ -150,17 +179,23 @@ Please set sslopt to {"check_hostname": False}. (since v0.18.0) - WebSocketApp sample:: + WebSocketApp sample + + .. code:: python ws = websocket.WebSocketApp("wss://echo.websocket.org") ws.run_forever(sslopt={"check_hostname": False}) - create_connection sample:: + create_connection sample + + .. code:: python ws = websocket.create_connection("wss://echo.websocket.org", sslopt={"check_hostname": False}) - WebSocket sample:: + WebSocket sample + + .. code:: python ws = websocket.WebSocket(sslopt={"check_hostname": False}) ws.connect("wss://echo.websocket.org") @@ -178,7 +213,9 @@ The server needs to support sub protocols, please set the subprotocol like this. - Subprotocol sample:: + Subprotocol sample + + .. code:: python ws = websocket.create_connection("ws://exapmle.com/websocket", subprotocols=["binary", "base64"]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.35.0/README.rst new/websocket_client-0.36.0/README.rst --- old/websocket_client-0.35.0/README.rst 2016-01-04 07:13:49.000000000 +0100 +++ new/websocket_client-0.36.0/README.rst 2016-04-12 01:43:10.000000000 +0200 @@ -43,7 +43,9 @@ Current implementation of websocket-client is using "CONNECT" method via proxy. -example:: +example + +.. code:: python import websocket ws = websocket.WebSocket() @@ -55,7 +57,9 @@ Example ============= -Low Level API example:: +Low Level API example + +.. code:: python from websocket import create_connection ws = create_connection("ws://echo.websocket.org/") @@ -69,14 +73,33 @@ If you want to customize socket options, set sockopt. -sockopt example:: +sockopt example + +.. code:: python from websocket import create_connection ws = create_connection("ws://echo.websocket.org/", sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY),)) +You can also use your own class for the connection. + +custom connection class example + +..code:: python + + from websocket import create_connection, WebSocket + class MyWebSocket(WebSocket): + def recv_frame(self): + frame = super().recv_frame() + print('yay! I got this frame: ', frame) + return frame + + ws = create_connection("ws://echo.websocket.org/", + sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY),), class_=MyWebSocket) + +JavaScript websocket-like API example -JavaScript websocket-like API example:: +.. code:: python import websocket import thread @@ -120,17 +143,23 @@ Please set sslopt to {"cert_reqs": ssl.CERT_NONE}. -WebSocketApp sample:: +WebSocketApp sample + +.. code:: python ws = websocket.WebSocketApp("wss://echo.websocket.org") ws.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE}) -create_connection sample:: +create_connection sample + +.. code:: python ws = websocket.create_connection("wss://echo.websocket.org", sslopt={"cert_reqs": ssl.CERT_NONE}) -WebSocket sample:: +WebSocket sample + +.. code:: python ws = websocket.WebSocket(sslopt={"cert_reqs": ssl.CERT_NONE}) ws.connect("wss://echo.websocket.org") @@ -142,17 +171,23 @@ Please set sslopt to {"check_hostname": False}. (since v0.18.0) -WebSocketApp sample:: +WebSocketApp sample + +.. code:: python ws = websocket.WebSocketApp("wss://echo.websocket.org") ws.run_forever(sslopt={"check_hostname": False}) -create_connection sample:: +create_connection sample + +.. code:: python ws = websocket.create_connection("wss://echo.websocket.org", sslopt={"check_hostname": False}) -WebSocket sample:: +WebSocket sample + +.. code:: python ws = websocket.WebSocket(sslopt={"check_hostname": False}) ws.connect("wss://echo.websocket.org") @@ -170,7 +205,9 @@ The server needs to support sub protocols, please set the subprotocol like this. -Subprotocol sample:: +Subprotocol sample + +.. code:: python ws = websocket.create_connection("ws://exapmle.com/websocket", subprotocols=["binary", "base64"]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.35.0/setup.py new/websocket_client-0.36.0/setup.py --- old/websocket_client-0.35.0/setup.py 2016-01-04 07:12:50.000000000 +0100 +++ new/websocket_client-0.36.0/setup.py 2016-04-12 01:43:46.000000000 +0200 @@ -1,7 +1,7 @@ from setuptools import setup import sys -VERSION = "0.35.0" +VERSION = "0.36.0" NAME="websocket_client" install_requires = ["six"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.35.0/websocket/__init__.py new/websocket_client-0.36.0/websocket/__init__.py --- old/websocket_client-0.35.0/websocket/__init__.py 2016-01-04 07:13:05.000000000 +0100 +++ new/websocket_client-0.36.0/websocket/__init__.py 2016-04-12 01:44:09.000000000 +0200 @@ -22,4 +22,4 @@ from ._core import * from ._app import WebSocketApp -__version__ = "0.35.0" +__version__ = "0.36.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.35.0/websocket/_app.py new/websocket_client-0.36.0/websocket/_app.py --- old/websocket_client-0.35.0/websocket/_app.py 2016-01-04 07:15:32.000000000 +0100 +++ new/websocket_client-0.36.0/websocket/_app.py 2016-04-12 01:58:13.000000000 +0200 @@ -67,7 +67,7 @@ this function has one argument. The argument is this class object. on_cont_message: callback object which is called when receive continued frame data. - on_message has 3 arguments. + on_cont_message has 3 arguments. The 1st argument is this class object. The 2nd argument is utf-8 string which we get from the server. The 3rd argument is continue flag. if 0, the data continue @@ -79,7 +79,7 @@ The 1st argument is this class object. The 2nd argument is utf-8 string which we get from the server. The 3rd argument is data type. ABNF.OPCODE_TEXT or ABNF.OPCODE_BINARY will be came. - The 4rd argument is continue flag. if 0, the data continue + The 4th argument is continue flag. if 0, the data continue keep_running: a boolean flag indicating whether the app's main loop should keep running, defaults to True get_mask_key: a callable to produce new mask keys, @@ -101,6 +101,7 @@ self.get_mask_key = get_mask_key self.sock = None self.last_ping_tm = 0 + self.last_pong_tm = 0 self.subprotocols = subprotocols def send(self, data, opcode=ABNF.OPCODE_TEXT): @@ -155,6 +156,8 @@ if not ping_timeout or ping_timeout <= 0: ping_timeout = None + if ping_timeout and ping_interval and ping_interval <= ping_timeout: + raise WebSocketException("Ensure ping_interval > ping_timeout") if sockopt is None: sockopt = [] if sslopt is None: @@ -188,9 +191,6 @@ r, w, e = select.select((self.sock.sock, ), (), (), ping_timeout) if not self.keep_running: break - if ping_timeout and self.last_ping_tm and time.time() - self.last_ping_tm > ping_timeout: - self.last_ping_tm = 0 - raise WebSocketTimeoutException("ping timed out") if r: op_code, frame = self.sock.recv_data_frame(True) @@ -200,6 +200,7 @@ elif op_code == ABNF.OPCODE_PING: self._callback(self.on_ping, frame.data) elif op_code == ABNF.OPCODE_PONG: + self.last_pong_tm = time.time() self._callback(self.on_pong, frame.data) elif op_code == ABNF.OPCODE_CONT and self.on_cont_message: self._callback(self.on_data, data, frame.opcode, frame.fin) @@ -210,10 +211,18 @@ data = data.decode("utf-8") self._callback(self.on_data, data, frame.opcode, True) self._callback(self.on_message, data) - except Exception as e: + + if ping_timeout and self.last_ping_tm \ + and self.last_ping_tm - time.time() > ping_timeout \ + and self.last_ping_tm - self.last_pong_tm > ping_timeout: + raise WebSocketTimeoutException("ping/pong timed out") + except (Exception, KeyboardInterrupt, SystemExit) as e: self._callback(self.on_error, e) + if isinstance(e, SystemExit): + # propagate SystemExit further + raise finally: - if thread: + if thread and thread.isAlive(): event.set() thread.join() self.keep_running = False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.35.0/websocket/_core.py new/websocket_client-0.36.0/websocket/_core.py --- old/websocket_client-0.35.0/websocket/_core.py 2016-01-04 07:18:45.000000000 +0100 +++ new/websocket_client-0.36.0/websocket/_core.py 2016-04-12 01:43:10.000000000 +0200 @@ -53,59 +53,6 @@ """ -def create_connection(url, timeout=None, **options): - """ - connect to url and return websocket object. - - Connect to url and return the WebSocket object. - Passing optional timeout parameter will set the timeout on the socket. - If no timeout is supplied, - the global default timeout setting returned by getdefauttimeout() is used. - You can customize using 'options'. - If you set "header" list object, you can set your own custom header. - - >>> conn = create_connection("ws://echo.websocket.org/", - ... header=["User-Agent: MyProgram", - ... "x-custom: header"]) - - - timeout: socket timeout time. This value is integer. - if you set None for this value, - it means "use default_timeout value" - - - options: "header" -> custom http header list or dict. - "cookie" -> cookie value. - "origin" -> custom origin url. - "host" -> custom host header string. - "http_proxy_host" - http proxy host name. - "http_proxy_port" - http proxy port. If not set, set to 80. - "http_no_proxy" - host names, which doesn't use proxy. - "http_proxy_auth" - http proxy auth information. - tuple of username and password. - default is None - "enable_multithread" -> enable lock for multithread. - "sockopt" -> socket options - "sslopt" -> ssl option - "subprotocols" - array of available sub protocols. - default is None. - "skip_utf8_validation" - skip utf8 validation. - "socket" - pre-initialized stream socket. - """ - sockopt = options.get("sockopt", []) - sslopt = options.get("sslopt", {}) - fire_cont_frame = options.get("fire_cont_frame", False) - enable_multithread = options.get("enable_multithread", False) - skip_utf8_validation = options.get("skip_utf8_validation", False) - websock = WebSocket(sockopt=sockopt, sslopt=sslopt, - fire_cont_frame=fire_cont_frame, - enable_multithread=enable_multithread, - skip_utf8_validation=skip_utf8_validation) - websock.settimeout(timeout if timeout is not None else getdefaulttimeout()) - websock.connect(url, **options) - return websock - - class WebSocket(object): """ Low level WebSocket interface. @@ -486,3 +433,58 @@ self.sock = None self.connected = False raise + + +def create_connection(url, timeout=None, class_=WebSocket, **options): + """ + connect to url and return websocket object. + + Connect to url and return the WebSocket object. + Passing optional timeout parameter will set the timeout on the socket. + If no timeout is supplied, + the global default timeout setting returned by getdefauttimeout() is used. + You can customize using 'options'. + If you set "header" list object, you can set your own custom header. + + >>> conn = create_connection("ws://echo.websocket.org/", + ... header=["User-Agent: MyProgram", + ... "x-custom: header"]) + + + timeout: socket timeout time. This value is integer. + if you set None for this value, + it means "use default_timeout value" + + class_: class to instantiate when creating the connection. It has to implement + settimeout and connect. It's __init__ should be compatible with + WebSocket.__init__, i.e. accept all of it's kwargs. + options: "header" -> custom http header list or dict. + "cookie" -> cookie value. + "origin" -> custom origin url. + "host" -> custom host header string. + "http_proxy_host" - http proxy host name. + "http_proxy_port" - http proxy port. If not set, set to 80. + "http_no_proxy" - host names, which doesn't use proxy. + "http_proxy_auth" - http proxy auth information. + tuple of username and password. + default is None + "enable_multithread" -> enable lock for multithread. + "sockopt" -> socket options + "sslopt" -> ssl option + "subprotocols" - array of available sub protocols. + default is None. + "skip_utf8_validation" - skip utf8 validation. + "socket" - pre-initialized stream socket. + """ + sockopt = options.pop("sockopt", []) + sslopt = options.pop("sslopt", {}) + fire_cont_frame = options.pop("fire_cont_frame", False) + enable_multithread = options.pop("enable_multithread", False) + skip_utf8_validation = options.pop("skip_utf8_validation", False) + websock = class_(sockopt=sockopt, sslopt=sslopt, + fire_cont_frame=fire_cont_frame, + enable_multithread=enable_multithread, + skip_utf8_validation=skip_utf8_validation, **options) + websock.settimeout(timeout if timeout is not None else getdefaulttimeout()) + websock.connect(url, **options) + return websock diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.35.0/websocket/_logging.py new/websocket_client-0.36.0/websocket/_logging.py --- old/websocket_client-0.35.0/websocket/_logging.py 2015-04-20 01:30:57.000000000 +0200 +++ new/websocket_client-0.36.0/websocket/_logging.py 2016-04-12 01:43:10.000000000 +0200 @@ -22,7 +22,7 @@ import logging -_logger = logging.getLogger() +_logger = logging.getLogger('websocket') _traceEnabled = False __all__ = ["enableTrace", "dump", "error", "debug", "trace", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/websocket_client-0.35.0/websocket_client.egg-info/PKG-INFO new/websocket_client-0.36.0/websocket_client.egg-info/PKG-INFO --- old/websocket_client-0.35.0/websocket_client.egg-info/PKG-INFO 2016-01-04 09:05:17.000000000 +0100 +++ new/websocket_client-0.36.0/websocket_client.egg-info/PKG-INFO 2016-04-12 02:02:42.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: websocket-client -Version: 0.35.0 +Version: 0.36.0 Summary: WebSocket client for python. hybi13 is supported. Home-page: https://github.com/liris/websocket-client Author: liris @@ -51,7 +51,9 @@ Current implementation of websocket-client is using "CONNECT" method via proxy. - example:: + example + + .. code:: python import websocket ws = websocket.WebSocket() @@ -63,7 +65,9 @@ Example ============= - Low Level API example:: + Low Level API example + + .. code:: python from websocket import create_connection ws = create_connection("ws://echo.websocket.org/") @@ -77,14 +81,33 @@ If you want to customize socket options, set sockopt. - sockopt example:: + sockopt example + + .. code:: python from websocket import create_connection ws = create_connection("ws://echo.websocket.org/", sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY),)) + You can also use your own class for the connection. + + custom connection class example + + ..code:: python + + from websocket import create_connection, WebSocket + class MyWebSocket(WebSocket): + def recv_frame(self): + frame = super().recv_frame() + print('yay! I got this frame: ', frame) + return frame + + ws = create_connection("ws://echo.websocket.org/", + sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY),), class_=MyWebSocket) + + JavaScript websocket-like API example - JavaScript websocket-like API example:: + .. code:: python import websocket import thread @@ -128,17 +151,23 @@ Please set sslopt to {"cert_reqs": ssl.CERT_NONE}. - WebSocketApp sample:: + WebSocketApp sample + + .. code:: python ws = websocket.WebSocketApp("wss://echo.websocket.org") ws.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE}) - create_connection sample:: + create_connection sample + + .. code:: python ws = websocket.create_connection("wss://echo.websocket.org", sslopt={"cert_reqs": ssl.CERT_NONE}) - WebSocket sample:: + WebSocket sample + + .. code:: python ws = websocket.WebSocket(sslopt={"cert_reqs": ssl.CERT_NONE}) ws.connect("wss://echo.websocket.org") @@ -150,17 +179,23 @@ Please set sslopt to {"check_hostname": False}. (since v0.18.0) - WebSocketApp sample:: + WebSocketApp sample + + .. code:: python ws = websocket.WebSocketApp("wss://echo.websocket.org") ws.run_forever(sslopt={"check_hostname": False}) - create_connection sample:: + create_connection sample + + .. code:: python ws = websocket.create_connection("wss://echo.websocket.org", sslopt={"check_hostname": False}) - WebSocket sample:: + WebSocket sample + + .. code:: python ws = websocket.WebSocket(sslopt={"check_hostname": False}) ws.connect("wss://echo.websocket.org") @@ -178,7 +213,9 @@ The server needs to support sub protocols, please set the subprotocol like this. - Subprotocol sample:: + Subprotocol sample + + .. code:: python ws = websocket.create_connection("ws://exapmle.com/websocket", subprotocols=["binary", "base64"])
participants (1)
-
root@hilbert.suse.de