wkeeling / selenium-wire

Extends Selenium's Python bindings to give you the ability to inspect requests made by the browser.
MIT License
1.9k stars 251 forks source link

Some sites do not load with proxy (works with other proxy auth methods, but not selenium wire) #651

Open oldwizard1010 opened 1 year ago

oldwizard1010 commented 1 year ago

I'm using chromium 109

Also throws this exceptions:

Exception in thread Http2SingleStreamLayer-3:
Traceback (most recent call last):
  File "~/.local/lib/python3.10/site-packages/seleniumwire/thirdparty/mitmproxy/net/http/encoding.py", line 62, in decode
    decoded = custom_decode[encoding](encoded)
  File "~/.local/lib/python3.10/site-packages/seleniumwire/thirdparty/mitmproxy/net/http/encoding.py", line 151, in decode_gzip
    return gfile.read()
  File "/usr/lib/python3.10/gzip.py", line 301, in read
    return self._buffer.read(size)
  File "/usr/lib/python3.10/_compression.py", line 118, in readall
    while data := self.read(sys.maxsize):
  File "/usr/lib/python3.10/gzip.py", line 488, in read
    if not self._read_gzip_header():
  File "/usr/lib/python3.10/gzip.py", line 436, in _read_gzip_header
    raise BadGzipFile('Not a gzipped file (%r)' % magic)
gzip.BadGzipFile: Not a gzipped file (b'{"')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "~/.local/lib/python3.10/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http2.py", line 719, in run
    layer()
  File "~/.local/lib/python3.10/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http.py", line 206, in __call__
    if not self._process_flow(flow):
  File "~/.local/lib/python3.10/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http.py", line 388, in _process_flow
    get_response()
  File "~/.local/lib/python3.10/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http.py", line 373, in get_response
    self.send_request_headers(f.request)
  File "~/.local/lib/python3.10/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http2.py", line 389, in wrapper
    result = func(self, *args, **kwargs)
  File "~/.local/lib/python3.10/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http2.py", line 609, in send_request_headers
    raise e
  File "~/.local/lib/python3.10/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http2.py", line 603, in send_request_headers
    end_stream=(False if request.content or request.trailers or request.stream else True),
  File "~/.local/lib/python3.10/site-packages/seleniumwire/thirdparty/mitmproxy/net/http/message.py", line 134, in get_content
    content = encoding.decode(self.raw_content, ce)
  File "~/.local/lib/python3.10/site-packages/seleniumwire/thirdparty/mitmproxy/net/http/encoding.py", line 71, in decode
    raise ValueError(
ValueError: BadGzipFile when decoding b'{"sdk_ve with 'gzip': BadGzipFile('Not a gzipped file (b\'{"\')')