Skip to content

Use of CLI parameter --http-ignore-env causes KeyError on all streams #5192

@dg362

Description

@dg362

Checklist

Streamlink version

Latest build from the master branch

Description

When using the parameter --http-ignore-env to ignore local environment variables for proxy, this always errors on any stream in the current/latest release. This worked on previous releases with no issues.
Any use of this CLI option gives an error KeyError: 'http-trust-env'

Test results below are from a common open non-DRM stream for m3u8 testing of
https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel.ism/.m3u8

Test results were performed on Debian Bookworm with Python 3.11.2 and Streamlink 5.3.0+11.g77e67a70

Debug log

When using the optional CLI parameter of "--http-ignore-env" this errors as per the command output below

streamlink --loglevel=debug --http-ignore-env https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel.ism/.m3u8 350p
[cli][debug] OS:         Linux-6.1.0-3-amd64-x86_64-with-glibc2.36
[cli][debug] Python:     3.11.2
[cli][debug] Streamlink: 5.3.0+11.g77e67a70
[cli][debug] Dependencies:
[cli][debug]  certifi: 2022.12.7
[cli][debug]  isodate: 0.6.1
[cli][debug]  lxml: 4.9.2
[cli][debug]  pycountry: 22.3.5
[cli][debug]  pycryptodome: 3.17
[cli][debug]  PySocks: 1.7.1
[cli][debug]  requests: 2.28.2
[cli][debug]  urllib3: 1.26.14
[cli][debug]  websocket-client: 1.5.1
[cli][debug] Arguments:
[cli][debug]  url=https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel.ism/.m3u8
[cli][debug]  stream=['350p']
[cli][debug]  --loglevel=debug
[cli][debug]  --http-ignore-env=True
Traceback (most recent call last):
  File "/home/mason/.myenv/streamlink/bin/streamlink", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/mason/.myenv/streamlink/lib/python3.11/site-packages/streamlink_cli/main.py", line 895, in main
    setup_session_options(streamlink, args)
  File "/home/mason/.myenv/streamlink/lib/python3.11/site-packages/streamlink_cli/argparser.py", line 1294, in setup_session_options
    session.set_option(option, value)
  File "/home/mason/.myenv/streamlink/lib/python3.11/site-packages/streamlink/session.py", line 473, in set_option
    self.options.set(key, value)
  File "/home/mason/.myenv/streamlink/lib/python3.11/site-packages/streamlink/options.py", line 54, in set
    method(self, normalized, value)
  File "/home/mason/.myenv/streamlink/lib/python3.11/site-packages/streamlink/session.py", line 108, in _set_http_attr
    setattr(self.session.http, self._OPTIONS_HTTP_ATTRS[key], value)
                               ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
KeyError: 'http-trust-env'


Exact same command without that CLI option works fine as per below.

streamlink --loglevel=debug https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel.ism/.m3u8 350p
[cli][debug] OS:         Linux-6.1.0-3-amd64-x86_64-with-glibc2.36
[cli][debug] Python:     3.11.2
[cli][debug] Streamlink: 5.3.0+11.g77e67a70
[cli][debug] Dependencies:
[cli][debug]  certifi: 2022.12.7
[cli][debug]  isodate: 0.6.1
[cli][debug]  lxml: 4.9.2
[cli][debug]  pycountry: 22.3.5
[cli][debug]  pycryptodome: 3.17
[cli][debug]  PySocks: 1.7.1
[cli][debug]  requests: 2.28.2
[cli][debug]  urllib3: 1.26.14
[cli][debug]  websocket-client: 1.5.1
[cli][debug] Arguments:
[cli][debug]  url=https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel.ism/.m3u8
[cli][debug]  stream=['350p']
[cli][debug]  --loglevel=debug
[cli][info] Found matching plugin hls for URL https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel.ism/.m3u8
[plugins.hls][debug] URL=https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel.ism/.m3u8; params={}
[utils.l10n][debug] Language code: en_GB
[cli][info] Available streams: 68k (worst), 140k, 100p, 200p, 350p, 750p_alt, 750p (best)
[cli][info] Opening stream: 350p (hls)
[cli][info] Starting player: /usr/bin/vlc
[stream.hls][debug] Reloading playlist
[cli][debug] Pre-buffering 8192 bytes
[stream.hls][debug] First Sequence: 1; Last Sequence: 184
[stream.hls][debug] Start offset: 0; Duration: None; Start Sequence: 1; End Sequence: 184
[stream.hls][debug] Adding segment 1 to queue
[stream.hls][debug] Adding segment 2 to queue

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions