1

I tried using different private proxies from multiple proxy seller companies to fetch the Binance websocket stream "wss://stream.binance.com:9443" But I got websocket._exceptions.WebSocketProxyException: failed CONNECT via proxy status: 407.

The documentation on the Binance Python Connector allows proxies to be used. Screenshot

I was wondering if someone succeded in connecting with a proxy?

Thank you.

The code used to test.

import websocket
proxy_host = "proxy_ip"
proxy_port = 8080
proxy_user = "proxy_user"
proxy_password = "proxy_password"
# WebSocket URL
ws_url = "wss://stream.binance.com:9443"
websocket.enableTrace(True)
proxy_info = (proxy_host, proxy_port, proxy_user, proxy_password)
http_proxy_url = f"http://{proxy_user}:{proxy_password}@{proxy_host}:{proxy_port}"
ws = websocket.create_connection(ws_url, http_proxy_host=proxy_host, http_proxy_port=proxy_port, http_proxy_auth=(proxy_user, proxy_password))
ws.close()

Output.

Connecting proxy...
--- request header ---
CONNECT stream.binance.com:9443 HTTP/1.1
Host: stream.binance.com:9443
Proxy-Authorization: Basic MTR*************YzA5
-----------------------
--- response header ---
HTTP/1.1 407 Proxy Authentication Required
Server: squid/5.7
Mime-Version: 1.0
Date: 2023年12月25日 11:34:44 GMT
Content-Type: text/html;charset=utf-8
Content-Length: 3515
X-Squid-Error: ERR_CACHE_ACCESS_DENIED 0
Vary: Accept-Language
Content-Language: en
Proxy-Authenticate: Basic realm="Username and password"
X-Cache: MISS from bugatti
X-Cache-Lookup: NONE from bugatti:12323
Connection: keep-alive
-----------------------

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.