Python socks.ProxyConnectionError() Examples
The following are 6
code examples of socks.ProxyConnectionError().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
socks
, or try the search function
.
Example #1
Source File: sockstest.py From phpsploit with GNU General Public License v3.0 | 5 votes |
def SOCKS5_connect_timeout_test(): s = socks.socksocket() s.settimeout(0.0001) s.set_proxy(socks.SOCKS5, "8.8.8.8", 80) try: s.connect(("ifconfig.me", 80)) except socks.ProxyConnectionError as e: assert str(e.socket_err) == "timed out"
Example #2
Source File: _http.py From vnpy_crypto with MIT License | 5 votes |
def _open_socket(addrinfo_list, sockopt, timeout): err = None for addrinfo in addrinfo_list: family, socktype, proto = addrinfo[:3] sock = socket.socket(family, socktype, proto) sock.settimeout(timeout) for opts in DEFAULT_SOCKET_OPTION: sock.setsockopt(*opts) for opts in sockopt: sock.setsockopt(*opts) address = addrinfo[4] try: sock.connect(address) err = None except ProxyConnectionError as error: err = WebSocketProxyException(str(error)) err.remote_ip = str(address[0]) continue except socket.error as error: error.remote_ip = str(address[0]) try: eConnRefused = (errno.ECONNREFUSED, errno.WSAECONNREFUSED) except: eConnRefused = (errno.ECONNREFUSED, ) if error.errno in eConnRefused: err = error continue else: raise error else: break else: raise err return sock
Example #3
Source File: _http.py From deepWordBug with Apache License 2.0 | 4 votes |
def _open_socket(addrinfo_list, sockopt, timeout): err = None for addrinfo in addrinfo_list: family, socktype, proto = addrinfo[:3] sock = socket.socket(family, socktype, proto) sock.settimeout(timeout) for opts in DEFAULT_SOCKET_OPTION: sock.setsockopt(*opts) for opts in sockopt: sock.setsockopt(*opts) address = addrinfo[4] err = None while not err: try: sock.connect(address) except ProxyConnectionError as error: err = WebSocketProxyException(str(error)) err.remote_ip = str(address[0]) continue except socket.error as error: error.remote_ip = str(address[0]) try: eConnRefused = (errno.ECONNREFUSED, errno.WSAECONNREFUSED) except: eConnRefused = (errno.ECONNREFUSED, ) if error.errno == errno.EINTR: continue elif error.errno in eConnRefused: err = error continue else: raise error else: break else: continue break else: if err: raise err return sock
Example #4
Source File: _http.py From launcher with GNU General Public License v3.0 | 4 votes |
def _open_socket(addrinfo_list, sockopt, timeout): err = None for addrinfo in addrinfo_list: family, socktype, proto = addrinfo[:3] sock = socket.socket(family, socktype, proto) sock.settimeout(timeout) for opts in DEFAULT_SOCKET_OPTION: sock.setsockopt(*opts) for opts in sockopt: sock.setsockopt(*opts) address = addrinfo[4] err = None while not err: try: sock.connect(address) except ProxyConnectionError as error: err = WebSocketProxyException(str(error)) err.remote_ip = str(address[0]) continue except socket.error as error: error.remote_ip = str(address[0]) try: eConnRefused = (errno.ECONNREFUSED, errno.WSAECONNREFUSED) except: eConnRefused = (errno.ECONNREFUSED, ) if error.errno == errno.EINTR: continue elif error.errno in eConnRefused: err = error continue else: raise error else: break else: continue break else: if err: raise err return sock
Example #5
Source File: rainbow.py From rainbowstream with MIT License | 4 votes |
def fly(): """ Main function """ # Initial args = parse_arguments() try: proxy_connect(args) init(args) # Twitter API connection problem except TwitterHTTPError as e: printNicely('') printNicely( magenta('We have connection problem with twitter REST API right now :(')) detail_twitter_error(e) save_history() sys.exit() # Proxy connection problem except (socks.ProxyConnectionError, URLError): printNicely( magenta('There seems to be a connection problem.')) printNicely( magenta('You might want to check your proxy settings (host, port and type)!')) save_history() sys.exit() # Spawn stream thread target = args.stream.split()[0] if target == 'mine': spawn_personal_stream(args) else: try: stuff = args.stream.split()[1] except: stuff = None spawn_dict = { 'public': spawn_public_stream, 'list': spawn_list_stream, } spawn_dict.get(target)(args, stuff) # Start listen process time.sleep(0.5) g['reset'] = True g['prefix'] = True listen()
Example #6
Source File: _http.py From Tautulli with GNU General Public License v3.0 | 4 votes |
def _open_socket(addrinfo_list, sockopt, timeout): err = None for addrinfo in addrinfo_list: family, socktype, proto = addrinfo[:3] sock = socket.socket(family, socktype, proto) sock.settimeout(timeout) for opts in DEFAULT_SOCKET_OPTION: sock.setsockopt(*opts) for opts in sockopt: sock.setsockopt(*opts) address = addrinfo[4] err = None while not err: try: sock.connect(address) except ProxyConnectionError as error: err = WebSocketProxyException(str(error)) err.remote_ip = str(address[0]) continue except socket.error as error: error.remote_ip = str(address[0]) try: eConnRefused = (errno.ECONNREFUSED, errno.WSAECONNREFUSED) except: eConnRefused = (errno.ECONNREFUSED, ) if error.errno == errno.EINTR: continue elif error.errno in eConnRefused: err = error continue else: raise error else: break else: continue break else: if err: raise err return sock