Open johnraysimpson opened 1 month ago
I've had a dig around and got it to work, I'm not sure if it's a bug or not but someone might be able to figure that out, but using
Session(proxies={"http": "http://some_proxy", "https": "https://some_proxy"})
doesn't appear to make websocket connections through that proxy. My work around at the moment is:
Session(proxy=some_proxy_str)
(was able to test as I have access to a few proxy providers and know of a websocket url that only works with some - using the first method made connections no matter the proxies whereas the second method failed on the proxies I expected to fail)
Thanks for posting your findings back.
I think we should add something like proxies={"ws": "http://some_proxy", "wss": "https://some_proxy"}
for consistency. Let's keep this open until it's resolved.
Ah right, makes more sense now, would it be nice to have a routine that converts the {"http": "http://some_proxy", "https": "https://some_proxy"}
in a session to proxies={"ws": "http://some_proxy", "wss": "https://some_proxy"}
when connecting to a websocket through Session
? Only use case is when needing to make normal requests and websocket connections with the same IP, I think that would be quite elegant
The question
I just wanted clarity on using proxies with a websocket specifically, I'm assuming that if I set up a session with certain proxies, then use the
ws_connect
method then the proxies will be utilised for that request? E.g.