From 1e58adda9397500d89b4521c90aa06e6a511cef6 Mon Sep 17 00:00:00 2001 From: Roy Hyunjin Han Date: Tue, 5 Sep 2017 23:20:01 +0000 Subject: [PATCH] Replace localhost with explicit 127.0.0.1 --- README.rst | 24 ++++++++++++------------ socketIO_client/__init__.py | 4 ++-- socketIO_client/namespaces.py | 2 +- socketIO_client/tests/__init__.py | 2 +- socketIO_client/tests/index.html | 2 +- socketIO_client/tests/proxy.js | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.rst b/README.rst index 8467512..6bd2be7 100644 --- a/README.rst +++ b/README.rst @@ -51,7 +51,7 @@ Emit. :: from socketIO_client import SocketIO, LoggingNamespace - with SocketIO('localhost', 8000, LoggingNamespace) as socketIO: + with SocketIO('127.0.0.1', 8000, LoggingNamespace) as socketIO: socketIO.emit('aaa') socketIO.wait(seconds=1) @@ -62,7 +62,7 @@ Emit with callback. :: def on_bbb_response(*args): print('on_bbb_response', args) - with SocketIO('localhost', 8000, LoggingNamespace) as socketIO: + with SocketIO('127.0.0.1', 8000, LoggingNamespace) as socketIO: socketIO.emit('bbb', {'xxx': 'yyy'}, on_bbb_response) socketIO.wait_for_callbacks(seconds=1) @@ -82,7 +82,7 @@ Define events. :: def on_aaa_response(*args): print('on_aaa_response', args) - socketIO = SocketIO('localhost', 8000, LoggingNamespace) + socketIO = SocketIO('127.0.0.1', 8000, LoggingNamespace) socketIO.on('connect', on_connect) socketIO.on('disconnect', on_disconnect) socketIO.on('reconnect', on_reconnect) @@ -114,7 +114,7 @@ Define events in a namespace. :: print('on_aaa_response', args) self.emit('bbb') - socketIO = SocketIO('localhost', 8000, Namespace) + socketIO = SocketIO('127.0.0.1', 8000, Namespace) socketIO.emit('aaa') socketIO.wait(seconds=1) @@ -133,7 +133,7 @@ Define standard events. :: def on_disconnect(self): print('[Disconnected]') - socketIO = SocketIO('localhost', 8000, Namespace) + socketIO = SocketIO('127.0.0.1', 8000, Namespace) socketIO.wait(seconds=1) Define different namespaces on a single socket. :: @@ -150,7 +150,7 @@ Define different namespaces on a single socket. :: def on_aaa_response(self, *args): print('on_aaa_response', args) - socketIO = SocketIO('localhost', 8000) + socketIO = SocketIO('127.0.0.1', 8000) chat_namespace = socketIO.define(ChatNamespace, '/chat') news_namespace = socketIO.define(NewsNamespace, '/news') @@ -163,11 +163,11 @@ Connect via SSL (https://github.com/invisibleroads/socketIO-client/issues/54). : from socketIO_client import SocketIO # Skip server certificate verification - SocketIO('https://localhost', verify=False) + SocketIO('https://127.0.0.1', verify=False) # Verify the server certificate - SocketIO('https://localhost', verify='server.crt') + SocketIO('https://127.0.0.1', verify='server.crt') # Verify the server certificate and encrypt using client certificate - socketIO = SocketIO('https://localhost', verify='server.crt', cert=( + socketIO = SocketIO('https://127.0.0.1', verify='server.crt', cert=( 'client.crt', 'client.key')) Specify params, headers, cookies, proxies thanks to the `requests `_ library. :: @@ -176,7 +176,7 @@ Specify params, headers, cookies, proxies thanks to the `requests