RIPE-NCC / ripe-atlas-cousteau

Python client for RIPE ATLAS API
GNU General Public License v3.0
65 stars 26 forks source link

bug: HTTP 407 error when AtlasStream(Streaming API) x proxy authentication #65

Open itaru2622 opened 1 year ago

itaru2622 commented 1 year ago

websocket-client document says: it needs http_proxy_auth attribute when proxy requiring authentication as described below. https://websocket-client.readthedocs.io/en/latest/examples.html#connecting-through-a-proxy

but that attribute is not involved in below code: https://github.com/RIPE-NCC/ripe-atlas-cousteau/blob/6d51e0cb3e38cfd31770f8eeeb37d12d9ffb1cea/ripe/atlas/cousteau/stream.py#L126-L130 then it raises 407 error as following:

  File "/usr/local/lib/python3.11/site-packages/ripe/atlas/cousteau/stream.py", line 135, in connect
    self.ws = websocket.create_connection(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/websocket/_core.py", line 601, in create_connection
    websock.connect(url, **options)
  File "/usr/local/lib/python3.11/site-packages/websocket/_core.py", line 244, in connect
    self.sock, addrs = connect(url, self.sock_opt, proxy_info(**options),
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/websocket/_http.py", line 132, in connect
    sock = _tunnel(sock, hostname, port, auth)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/websocket/_http.py", line 299, in _tunnel
    raise WebSocketProxyException(
websocket._exceptions.WebSocketProxyException: failed CONNECT via proxy status: 407