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 254 forks source link

"LookupError: unknown encoding: amz-1.0" in mitmproxy code #467

Open toabctl opened 2 years ago

toabctl commented 2 years ago

Using selenium-wire 4.5.6 and trying the get some data from AWS quickstart, I ran into:

Exception in thread Http2SingleStreamLayer-29:
Traceback (most recent call last):
  File "aws-marketplace-ubuntu-scraper/venv/lib/python3.9/site-packages/seleniumwire/thirdparty/mitmproxy/net/http/encoding.py", line 62, in decode
    decoded = custom_decode[encoding](encoded)
KeyError: 'amz-1.0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "aws-marketplace-ubuntu-scraper/venv/lib/python3.9/site-packages/seleniumwire/thirdparty/mitmproxy/net/http/encoding.py", line 64, in decode
    decoded = codecs.decode(encoded, encoding, errors)  # type: ignore
LookupError: unknown encoding: amz-1.0
wkeeling commented 2 years ago

Thanks for raising this.

The content encoding amz-1.0 isn't currently supported, but we can look at adding support for that. In the meantime you may be able to workaround the problem by setting the disable_encoding option in the seleniumwire_options.

toabctl commented 2 years ago

the workaround does not change anything. I use now:

seleniumwire_options = {
    'disable_encoding': True
}
driver = webdriver.Firefox(options=driver_options,
                               seleniumwire_options=seleniumwire_options)

Still the same problem.

pawanpaudel93 commented 1 year ago

@toabctl do you have a workaround for this issue ??? I am, too facing the same issue.