DMTF/python-redfish-library

Socks proxy

neodino opened this issue · 9 comments

Any chance to implement proxy (SOCKS5) support?

@neodino - you mention SOCKS5 proxy specifically. Does your use case really require a SOCKS5 proxy or would an http/https proxy suffice?

python-redfish-library uses the python http client (httplib in python 2, http.client in python 3). And it looks like the python http client has support for using http/https proxies. That could probably be leveraged by python-redfish-library.

References:
https://docs.python.org/2/library/httplib.html#httplib.HTTPConnection.set_tunnel
https://docs.python.org/3/library/http.client.html#http.client.HTTPConnection.set_tunnel

Yes, using socks5. Creating socks proxy over ssh tunnel.
I did came across referenced, but does not support socks5.
Tried this:
https://stackoverflow.com/questions/44893913/how-can-you-connect-through-a-socks-proxy-with-python-httplib-http-client
but no luck.
Any other idea?

2/15: We'll have to think about this one more; we don't have a clear answer on how to do this either...

6/7: @jautor will follow up with his team to see if this sort of functionality is reasonable

But if you'd like to make changes to the library yourself, you're more than welcome to submit something!

I believe this issue is solved since 3.1.0 moved to requests.

pip install -U requests[socks]
export https_proxy=socks5h://localhost:8123

You're right; that should allow for SOCKS proxies now.

Would it be useful to add requests[socks] to requirements.txt?

I would just add an additional comment to this section (https://github.com/DMTF/python-redfish-library#using-proxies) as I think it is a limited use case to require everyone to pull in an additional package.

Great, thanks for the recommendation! I can update the readme for that