You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
from curl_cffi import requests
session = requests.Session(proxies=some_proxy_dict)
ws = session.ws_connect(some_ws_url) # the proxies are passed from the session to the websocket connection
The text was updated successfully, but these errors were encountered:
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)
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.The text was updated successfully, but these errors were encountered: