diff --git a/ChangeLog b/ChangeLog index 218b8d5..af58e78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,7 +21,7 @@ ChangeLog - WebSocketBadStatusException for Handshake error (#199) - set close timeout (#192) - Map dict to headers list (#204) - - support client certication (#207) + - support client certification (#207) - security improvement during handshake (#211) - improve logging of error from callback (#212) @@ -59,7 +59,7 @@ ChangeLog - remove unittest2 requirements for python 2.6 (#156) - fixed subprotocol case during header validation (#158) - get response status and headers (#160) - - fix out-of-memory due to fragmentation when recieving a very large frame(#163) + - fix out-of-memory due to fragmentation when receiving a very large frame(#163) - fix error if the payload data is nothing.(#166) - refactoring. @@ -88,7 +88,7 @@ ChangeLog - Fix not thread-safe of Websocket.close() (#120) - Try to get proxy info from environment if not explicitly provided (#124) - - support proxy basic authenticaiton. (#125) + - support proxy basic authentication. (#125) - Fix NoneType exception at WebsocketApp.send (#126) - not use proxy for localhost (#132) diff --git a/README.rst b/README.rst index e60ea5d..858b8f5 100644 --- a/README.rst +++ b/README.rst @@ -167,7 +167,7 @@ SNI support is available for Python 2.7.9+ and 3.2+. It will be enabled automati Sub Protocols. ---------------------------------------- -The server needs to support sub protocols, please set the subprotcol like this. +The server needs to support sub protocols, please set the subprotocol like this. Subprotocol sample:: diff --git a/bin/wsdump.py b/bin/wsdump.py index d02b813..c2fb49f 100755 --- a/bin/wsdump.py +++ b/bin/wsdump.py @@ -55,7 +55,7 @@ def parse_args(): parser.add_argument("-o", "--origin", help="Set origin") parser.add_argument("--eof-wait", default=0, type=int, - help="wait time(second) after 'EOF' recieved.") + help="wait time(second) after 'EOF' received.") parser.add_argument("-t", "--text", help="Send initial text") parser.add_argument("--timings", action="store_true", diff --git a/compliance/test_fuzzingclient.py b/compliance/test_fuzzingclient.py index 418f623..8235dfb 100644 --- a/compliance/test_fuzzingclient.py +++ b/compliance/test_fuzzingclient.py @@ -10,7 +10,7 @@ import six SERVER = 'ws://127.0.0.1:8642' -AGENT = 'py-websockets-cleint' +AGENT = 'py-websockets-client' ws = websocket.create_connection(SERVER + "/getCaseCount") diff --git a/examples/echoapp_client.py b/examples/echoapp_client.py index f7e996a..48850b9 100644 --- a/examples/echoapp_client.py +++ b/examples/echoapp_client.py @@ -23,8 +23,8 @@ def on_open(ws): def run(*args): for i in range(3): # send the message, then wait - # so thread doesnt exit and socket - # isnt closed + # so thread doesn't exit and socket + # isn't closed ws.send("Hello %d" % i) time.sleep(1) diff --git a/websocket/_abnf.py b/websocket/_abnf.py index 04a8505..2c7c4ab 100644 --- a/websocket/_abnf.py +++ b/websocket/_abnf.py @@ -99,7 +99,7 @@ class ABNF(object): OPCODE_PONG: "pong" } - # data length threashold. + # data length threshold. LENGTH_7 = 0x7e LENGTH_16 = 1 << 16 LENGTH_63 = 1 << 63 @@ -162,8 +162,8 @@ class ABNF(object): create frame to send text, binary and other data. data: data to send. This is string value(byte array). - if opcode is OPCODE_TEXT and this value is uniocde, - data value is conveted into unicode string, automatically. + if opcode is OPCODE_TEXT and this value is unicode, + data value is converted into unicode string, automatically. opcode: operation code. please see OPCODE_XXX. diff --git a/websocket/_app.py b/websocket/_app.py index f8632d7..dfa5237 100644 --- a/websocket/_app.py +++ b/websocket/_app.py @@ -54,32 +54,32 @@ class WebSocketApp(object): url: websocket url. header: custom header for websocket handshake. on_open: callable object which is called at opening websocket. - this function has one argument. The arugment is this class object. - on_message: callbale object which is called when recieved data. + this function has one argument. The argument is this class object. + on_message: callable object which is called when received data. on_message has 2 arguments. - The 1st arugment is this class object. - The passing 2nd arugment is utf-8 string which we get from the server. + The 1st argument is this class object. + The 2nd argument is utf-8 string which we get from the server. on_error: callable object which is called when we get error. on_error has 2 arguments. - The 1st arugment is this class object. - The passing 2nd arugment is exception object. + The 1st argument is this class object. + The 2nd argument is exception object. on_close: callable object which is called when closed the connection. - this function has one argument. The arugment is this class object. - on_cont_message: callback object which is called when recieve continued + 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. - The 1st arugment is this class object. - The passing 2nd arugment is utf-8 string which we get from the server. - The 3rd arugment is continue flag. if 0, the data continue + 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 to next frame data - on_data: callback object which is called when a message recieved. + on_data: callback object which is called when a message received. This is called before on_message or on_cont_message, and then on_message or on_cont_message is called. on_data has 4 argument. - The 1st arugment is this class object. - The passing 2nd arugment is utf-8 string which we get from the server. + 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 arugment is continue flag. if 0, the data continue + The 4rd 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, @@ -139,12 +139,12 @@ class WebSocketApp(object): This loop is infinite loop and is alive during websocket is available. sockopt: values for socket.setsockopt. sockopt must be tuple - and each element is argument of sock.setscokopt. + and each element is argument of sock.setsockopt. sslopt: ssl socket optional dict. ping_interval: automatically send "ping" command every specified period(second) if set to 0, not send automatically. - ping_timeout: timeout(second) if the pong message is not recieved. + ping_timeout: timeout(second) if the pong message is not received. 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. diff --git a/websocket/_core.py b/websocket/_core.py index 5f0942e..e206717 100644 --- a/websocket/_core.py +++ b/websocket/_core.py @@ -81,7 +81,7 @@ def create_connection(url, timeout=None, **options): "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 infomation. + "http_proxy_auth" - http proxy auth information. tuple of username and password. default is None "enable_multithread" -> enable lock for multithread. @@ -112,8 +112,8 @@ class WebSocket(object): The WebSocket protocol draft-hixie-thewebsocketprotocol-76 http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76 - We can connect to the websocket server and send/recieve data. - The following example is a echo client. + We can connect to the websocket server and send/receive data. + The following example is an echo client. >>> import websocket >>> ws = websocket.WebSocket() @@ -126,7 +126,7 @@ class WebSocket(object): get_mask_key: a callable to produce new mask keys, see the set_mask_key function's docstring for more details sockopt: values for socket.setsockopt. - sockopt must be tuple and each element is argument of sock.setscokopt. + sockopt must be tuple and each element is argument of sock.setsockopt. sslopt: dict object for ssl socket option. fire_cont_frame: fire recv event for each cont frame. default is False enable_multithread: if set to True, lock send method. @@ -137,7 +137,7 @@ class WebSocket(object): fire_cont_frame=False, enable_multithread=False, skip_utf8_validation=False): """ - Initalize WebSocket object. + Initialize WebSocket object. """ self.sock_opt = sock_opt(sockopt, sslopt) self.handshake_response = None @@ -172,12 +172,12 @@ class WebSocket(object): def set_mask_key(self, func): """ - set function to create musk key. You can custumize mask key generator. + set function to create musk key. You can customize mask key generator. Mainly, this is for testing purpose. - func: callable object. the fuct must 1 argument as integer. + func: callable object. the func takes 1 argument as integer. The argument means length of mask key. - This func must be return string(byte array), + This func must return string(byte array), which length is argument specified. """ self.get_mask_key = func @@ -256,9 +256,9 @@ class WebSocket(object): "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 infomation. + "http_proxy_auth" - http proxy auth information. tuple of username and password. - defualt is None + default is None "subprotocols" - array of available sub protocols. default is None. @@ -355,7 +355,7 @@ class WebSocket(object): def recv_data(self, control_frame=False): """ - Recieve data with operation code. + Receive data with operation code. control_frame: a boolean flag indicating whether to return control frame data, defaults to False @@ -367,7 +367,7 @@ class WebSocket(object): def recv_data_frame(self, control_frame=False): """ - Recieve data with operation code. + Receive data with operation code. control_frame: a boolean flag indicating whether to return control frame data, defaults to False @@ -403,7 +403,7 @@ class WebSocket(object): def recv_frame(self): """ - recieve data as frame from server. + receive data as frame from server. return value: ABNF frame object. """ @@ -430,8 +430,8 @@ class WebSocket(object): reason: the reason to close. This must be string. - timeout: timeout until recieve a close frame. - If None, it will wait forever until recieve a close frame. + timeout: timeout until receive a close frame. + If None, it will wait forever until receive a close frame. """ if self.connected: if status < 0 or status >= ABNF.LENGTH_16: @@ -459,7 +459,7 @@ class WebSocket(object): def abort(self): """ - Low-level asynchonous abort, wakes up other threads that are waiting in recv_* + Low-level asynchronous abort, wakes up other threads that are waiting in recv_* """ if self.connected: self.sock.shutdown(socket.SHUT_RDWR) diff --git a/websocket/_exceptions.py b/websocket/_exceptions.py index ffc41ab..7b3e508 100644 --- a/websocket/_exceptions.py +++ b/websocket/_exceptions.py @@ -27,21 +27,21 @@ define websocket exceptions class WebSocketException(Exception): """ - websocket exeception class. + websocket exception class. """ pass class WebSocketProtocolException(WebSocketException): """ - If the webscoket protocol is invalid, this exception will be raised. + If the websocket protocol is invalid, this exception will be raised. """ pass class WebSocketPayloadException(WebSocketException): """ - If the webscoket payload is invalid, this exception will be raised. + If the websocket payload is invalid, this exception will be raised. """ pass @@ -63,7 +63,7 @@ class WebSocketTimeoutException(WebSocketException): class WebSocketProxyException(WebSocketException): """ - WebSocketProxyException will be raised when proxy error occured. + WebSocketProxyException will be raised when proxy error occurred. """ pass diff --git a/websocket/_url.py b/websocket/_url.py index 703b715..dfd2c4b 100644 --- a/websocket/_url.py +++ b/websocket/_url.py @@ -100,9 +100,9 @@ def get_proxy_info(hostname, is_secure, options: "http_proxy_host" - http proxy host name. "http_proxy_port" - http proxy port. "http_no_proxy" - host names, which doesn't use proxy. - "http_proxy_auth" - http proxy auth infomation. + "http_proxy_auth" - http proxy auth information. tuple of username and password. - defualt is None + default is None """ if _is_no_proxy_host(hostname, no_proxy): return None, 0, None diff --git a/websocket/_utils.py b/websocket/_utils.py index ac14b4a..58f6950 100644 --- a/websocket/_utils.py +++ b/websocket/_utils.py @@ -32,7 +32,7 @@ class NoLock(object): pass try: - # If wsaccel is availabe we use compiled routines to validate UTF-8 + # If wsaccel is available we use compiled routines to validate UTF-8 # strings. from wsaccel.utf8validator import Utf8Validator