fix typos

This commit is contained in:
Jakub Wilk
2016-01-03 20:39:45 +01:00
parent 4d5bc1e4e3
commit 645e9322d4
11 changed files with 51 additions and 51 deletions

View File

@@ -19,7 +19,7 @@ ChangeLog
- WebSocketBadStatusException for Handshake error (#199) - WebSocketBadStatusException for Handshake error (#199)
- set close timeout (#192) - set close timeout (#192)
- Map dict to headers list (#204) - Map dict to headers list (#204)
- support client certication (#207) - support client certification (#207)
- security improvement during handshake (#211) - security improvement during handshake (#211)
- improve logging of error from callback (#212) - improve logging of error from callback (#212)
@@ -57,7 +57,7 @@ ChangeLog
- remove unittest2 requirements for python 2.6 (#156) - remove unittest2 requirements for python 2.6 (#156)
- fixed subprotocol case during header validation (#158) - fixed subprotocol case during header validation (#158)
- get response status and headers (#160) - 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) - fix error if the payload data is nothing.(#166)
- refactoring. - refactoring.
@@ -86,7 +86,7 @@ ChangeLog
- Fix not thread-safe of Websocket.close() (#120) - Fix not thread-safe of Websocket.close() (#120)
- Try to get proxy info from environment if not explicitly provided (#124) - 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) - Fix NoneType exception at WebsocketApp.send (#126)
- not use proxy for localhost (#132) - not use proxy for localhost (#132)

View File

@@ -167,7 +167,7 @@ SNI support is available for Python 2.7.9+ and 3.2+. It will be enabled automati
Sub Protocols. 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:: Subprotocol sample::

View File

@@ -55,7 +55,7 @@ def parse_args():
parser.add_argument("-o", "--origin", parser.add_argument("-o", "--origin",
help="Set origin") help="Set origin")
parser.add_argument("--eof-wait", default=0, type=int, 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", parser.add_argument("-t", "--text",
help="Send initial text") help="Send initial text")

View File

@@ -10,7 +10,7 @@ import six
SERVER = 'ws://127.0.0.1:8642' SERVER = 'ws://127.0.0.1:8642'
AGENT = 'py-websockets-cleint' AGENT = 'py-websockets-client'
ws = websocket.create_connection(SERVER + "/getCaseCount") ws = websocket.create_connection(SERVER + "/getCaseCount")

View File

@@ -23,8 +23,8 @@ def on_open(ws):
def run(*args): def run(*args):
for i in range(3): for i in range(3):
# send the message, then wait # send the message, then wait
# so thread doesnt exit and socket # so thread doesn't exit and socket
# isnt closed # isn't closed
ws.send("Hello %d" % i) ws.send("Hello %d" % i)
time.sleep(1) time.sleep(1)

View File

@@ -99,7 +99,7 @@ class ABNF(object):
OPCODE_PONG: "pong" OPCODE_PONG: "pong"
} }
# data length threashold. # data length threshold.
LENGTH_7 = 0x7e LENGTH_7 = 0x7e
LENGTH_16 = 1 << 16 LENGTH_16 = 1 << 16
LENGTH_63 = 1 << 63 LENGTH_63 = 1 << 63
@@ -162,8 +162,8 @@ class ABNF(object):
create frame to send text, binary and other data. create frame to send text, binary and other data.
data: data to send. This is string value(byte array). data: data to send. This is string value(byte array).
if opcode is OPCODE_TEXT and this value is uniocde, if opcode is OPCODE_TEXT and this value is unicode,
data value is conveted into unicode string, automatically. data value is converted into unicode string, automatically.
opcode: operation code. please see OPCODE_XXX. opcode: operation code. please see OPCODE_XXX.

View File

@@ -54,32 +54,32 @@ class WebSocketApp(object):
url: websocket url. url: websocket url.
header: custom header for websocket handshake. header: custom header for websocket handshake.
on_open: callable object which is called at opening websocket. on_open: callable object which is called at opening websocket.
this function has one argument. The arugment is this class object. this function has one argument. The argument is this class object.
on_message: callbale object which is called when recieved data. on_message: callable object which is called when received data.
on_message has 2 arguments. on_message has 2 arguments.
The 1st arugment is this class object. The 1st argument is this class object.
The passing 2nd arugment is utf-8 string which we get from the server. 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: callable object which is called when we get error.
on_error has 2 arguments. on_error has 2 arguments.
The 1st arugment is this class object. The 1st argument is this class object.
The passing 2nd arugment is exception object. The 2nd argument is exception object.
on_close: callable object which is called when closed the connection. on_close: callable object which is called when closed the connection.
this function has one argument. The arugment is this class object. this function has one argument. The argument is this class object.
on_cont_message: callback object which is called when recieve continued on_cont_message: callback object which is called when receive continued
frame data. frame data.
on_message has 3 arguments. on_message has 3 arguments.
The 1st arugment is this class object. The 1st argument is this class object.
The passing 2nd arugment is utf-8 string which we get from the server. The 2nd argument is utf-8 string which we get from the server.
The 3rd arugment is continue flag. if 0, the data continue The 3rd argument is continue flag. if 0, the data continue
to next frame data 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, This is called before on_message or on_cont_message,
and then on_message or on_cont_message is called. and then on_message or on_cont_message is called.
on_data has 4 argument. on_data has 4 argument.
The 1st arugment is this class object. The 1st argument is this class object.
The passing 2nd arugment is utf-8 string which we get from the server. 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 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 keep_running: a boolean flag indicating whether the app's main loop
should keep running, defaults to True should keep running, defaults to True
get_mask_key: a callable to produce new mask keys, 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. This loop is infinite loop and is alive during websocket is available.
sockopt: values for socket.setsockopt. sockopt: values for socket.setsockopt.
sockopt must be tuple 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. sslopt: ssl socket optional dict.
ping_interval: automatically send "ping" command ping_interval: automatically send "ping" command
every specified period(second) every specified period(second)
if set to 0, not send automatically. 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_host: http proxy host name.
http_proxy_port: http proxy port. If not set, set to 80. http_proxy_port: http proxy port. If not set, set to 80.
http_no_proxy: host names, which doesn't use proxy. http_no_proxy: host names, which doesn't use proxy.

View File

@@ -81,7 +81,7 @@ def create_connection(url, timeout=None, **options):
"http_proxy_host" - http proxy host name. "http_proxy_host" - http proxy host name.
"http_proxy_port" - http proxy port. If not set, set to 80. "http_proxy_port" - http proxy port. If not set, set to 80.
"http_no_proxy" - host names, which doesn't use proxy. "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. tuple of username and password.
default is None default is None
"enable_multithread" -> enable lock for multithread. "enable_multithread" -> enable lock for multithread.
@@ -112,8 +112,8 @@ class WebSocket(object):
The WebSocket protocol draft-hixie-thewebsocketprotocol-76 The WebSocket protocol draft-hixie-thewebsocketprotocol-76
http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76 http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76
We can connect to the websocket server and send/recieve data. We can connect to the websocket server and send/receive data.
The following example is a echo client. The following example is an echo client.
>>> import websocket >>> import websocket
>>> ws = websocket.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 get_mask_key: a callable to produce new mask keys, see the set_mask_key
function's docstring for more details function's docstring for more details
sockopt: values for socket.setsockopt. 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. sslopt: dict object for ssl socket option.
fire_cont_frame: fire recv event for each cont frame. default is False fire_cont_frame: fire recv event for each cont frame. default is False
enable_multithread: if set to True, lock send method. enable_multithread: if set to True, lock send method.
@@ -137,7 +137,7 @@ class WebSocket(object):
fire_cont_frame=False, enable_multithread=False, fire_cont_frame=False, enable_multithread=False,
skip_utf8_validation=False): skip_utf8_validation=False):
""" """
Initalize WebSocket object. Initialize WebSocket object.
""" """
self.sock_opt = sock_opt(sockopt, sslopt) self.sock_opt = sock_opt(sockopt, sslopt)
self.handshake_response = None self.handshake_response = None
@@ -172,12 +172,12 @@ class WebSocket(object):
def set_mask_key(self, func): 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. 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. 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. which length is argument specified.
""" """
self.get_mask_key = func self.get_mask_key = func
@@ -256,9 +256,9 @@ class WebSocket(object):
"http_proxy_host" - http proxy host name. "http_proxy_host" - http proxy host name.
"http_proxy_port" - http proxy port. If not set, set to 80. "http_proxy_port" - http proxy port. If not set, set to 80.
"http_no_proxy" - host names, which doesn't use proxy. "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. tuple of username and password.
defualt is None default is None
"subprotocols" - array of available sub protocols. "subprotocols" - array of available sub protocols.
default is None. default is None.
@@ -355,7 +355,7 @@ class WebSocket(object):
def recv_data(self, control_frame=False): 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 control_frame: a boolean flag indicating whether to return control frame
data, defaults to False data, defaults to False
@@ -367,7 +367,7 @@ class WebSocket(object):
def recv_data_frame(self, control_frame=False): 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 control_frame: a boolean flag indicating whether to return control frame
data, defaults to False data, defaults to False
@@ -403,7 +403,7 @@ class WebSocket(object):
def recv_frame(self): def recv_frame(self):
""" """
recieve data as frame from server. receive data as frame from server.
return value: ABNF frame object. return value: ABNF frame object.
""" """
@@ -430,8 +430,8 @@ class WebSocket(object):
reason: the reason to close. This must be string. reason: the reason to close. This must be string.
timeout: timeout until recieve a close frame. timeout: timeout until receive a close frame.
If None, it will wait forever until recieve a close frame. If None, it will wait forever until receive a close frame.
""" """
if self.connected: if self.connected:
if status < 0 or status >= ABNF.LENGTH_16: if status < 0 or status >= ABNF.LENGTH_16:
@@ -459,7 +459,7 @@ class WebSocket(object):
def abort(self): 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: if self.connected:
self.sock.shutdown(socket.SHUT_RDWR) self.sock.shutdown(socket.SHUT_RDWR)

View File

@@ -27,21 +27,21 @@ define websocket exceptions
class WebSocketException(Exception): class WebSocketException(Exception):
""" """
websocket exeception class. websocket exception class.
""" """
pass pass
class WebSocketProtocolException(WebSocketException): 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 pass
class WebSocketPayloadException(WebSocketException): 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 pass
@@ -63,7 +63,7 @@ class WebSocketTimeoutException(WebSocketException):
class WebSocketProxyException(WebSocketException): class WebSocketProxyException(WebSocketException):
""" """
WebSocketProxyException will be raised when proxy error occured. WebSocketProxyException will be raised when proxy error occurred.
""" """
pass pass

View File

@@ -100,9 +100,9 @@ def get_proxy_info(hostname, is_secure,
options: "http_proxy_host" - http proxy host name. options: "http_proxy_host" - http proxy host name.
"http_proxy_port" - http proxy port. "http_proxy_port" - http proxy port.
"http_no_proxy" - host names, which doesn't use proxy. "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. tuple of username and password.
defualt is None default is None
""" """
if _is_no_proxy_host(hostname, no_proxy): if _is_no_proxy_host(hostname, no_proxy):
return None, 0, None return None, 0, None

View File

@@ -32,7 +32,7 @@ class NoLock(object):
pass pass
try: 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. # strings.
from wsaccel.utf8validator import Utf8Validator from wsaccel.utf8validator import Utf8Validator