-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Throws errors with socks module #1147
Comments
Very interesting. I wonder if this is a bug with socks or not. |
It looks like wrapmodule (from the trace back) is trying to monkey patch the socket stdlib. We don't use it directly, so if it isn't expecting our use of urllib3 then it makes sense it would fail. |
Yep. The author should probably use inspect to see where (if anywhere) a package or module is using the socket library. I'm of the opinion that this is an issue with |
+1. I'd be happy to reasonably accomidate, but we can't do so easily in this case. |
I wonder if there is a way to import it from urllib3 so it would properly work. |
considering the popularity of requests, I think adding special support for it in socks would be a good idea :) |
Hm, are you sure this works with urllib3? I can understand why it would work for httplib. The import is right there, but I see no import of socket that would be reachable from simply import urllib3. And yeah @kennethreitz I think it would be great too, that's why I'm exploring it. |
I mean for him to do the work instead of us :) |
Yeah @kennethreitz that would always be the ideal case. :) @infodox, in a clean virtualenv I just installed urllib3 (1.5 from pypi) and downloaded the socks.py file. This is my interactive session: >>> import socks
>>> import urllib3
>>> socks.wrapmodule(urllib3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "socks.py", line 111, in wrapmodule
raise GeneralProxyError((4, "no proxy specified"))
socks.GeneralProxyError: (4, 'no proxy specified')
>>> socks._defaultproxy = True
>>> socks.wrapmodule(urllib3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "socks.py", line 109, in wrapmodule
module.socket.socket = socksocket
AttributeError: 'module' object has no attribute 'socket' Are you sure it works fine on urllib3? It might work if you did: As for us, I think we could import socket from |
@infodox, having given it some thought, I honestly think that |
Hey,
I have been trying to get requests to play nice with the "Socks" module (from http://code.google.com/p/socksipy-branch/). urllib3 and httplib work fine with it, but the requests wrapper does not. Here is an example.
Hopefully there is a workaround for this :) Socks works with almost every other module, so it makes no sense for it to not work with requests.
The text was updated successfully, but these errors were encountered: