LoginSignup
0
0

python の websocket 通信で proxy を通したい

Posted at

本日(2023/11/29)で通用する方法です。
公式に描いてあります

pip install websocket-client

コード側:

proxy_settings = {
    'proxy_type':'http',      # <- 忘れずに
    'http_proxy_host':'proxy.servername.com',   # <- http: とかいらない
    'http_proxy_port':8080
}

ws_app = websocket.WebSocketApp(
    ws_uri,
    on_message=on_message,
    on_error=on_error,
    on_close=on_close,
    on_open=on_open
)

ws_app.run_forever(**proxy_settings)

簡単!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0