Monkeypatch throws stacktrace
Closed this issue · 2 comments
abrahamrhoffman commented
import socket, socks
import urllib2
socks.set_default_proxy(socks.SOCKS5, "localhost", 44000)
socket.socket = socks.socksocket
urllib2 call
[...]
socks.GeneralProxyError: Socket error: timed out
Request is a more elegant way to handle time outs. Allowing me to skip and print something to stdout would be great! :)
Anorov commented
Does the code work properly if you don't monkeypatch?
For example:
sock = socks.socksocket()
sock.set_proxy(socks.SOCKS5, "localhost", 44000)
sock.connect(("hostname.com", 80))
sock.sendall("GET / HTTP/1.1\r\n...")
print sock.recv(1048)
abrahamrhoffman commented
Yep, thanks! I guess monkeypatching is for monkeys :P