Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip-audit raises TypeError: HTTPResponse #613

Closed
Tomperez98 opened this issue May 17, 2023 · 1 comment
Closed

pip-audit raises TypeError: HTTPResponse #613

Tomperez98 opened this issue May 17, 2023 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@Tomperez98
Copy link

Bug description

pip-audit fails due to TypeError: HTTPResponse.__init__() got an unexpected keyword argument 'strict'

Reproduction steps

python --version
# Python 3.10.6

pip install pip-audit==2.5.2
pip-audit --version
# pip-audit 2.5.2

pip-audit -r requirements/dev.txt
# !error
# ...
# TypeError: HTTPResponse.__init__() got an unexpected keyword argument 'strict'

Expected behavior

To pip-audit to work

Screenshots and logs

If applicable, add screenshots to help explain your problem.

Similarly, if applicable and possible, re-run the command with --verbose,
and paste the logs in the code block below:

pip-audit -r requirements/dev.txt --verbose

DEBUG:pip_audit._cli:parsed arguments: Namespace(local=False, requirements=[<_io.TextIOWrapper name='requirements/dev.txt' mode='r' encoding='UTF-8'>], project_path=None, format=<OutputFormatChoice.Columns: 'columns'>, vulnerability_service=<VulnerabilityServiceChoice.Pypi: 'pypi'>, dry_run=False, strict=False, desc=<VulnerabilityDescriptionChoice.Auto: 'auto'>, cache_dir=None, progress_spinner=<ProgressSpinnerChoice.On: 'on'>, timeout=15, paths=[], verbose=1, fix=False, require_hashes=False, index_url='https://pypi.org/simple/', extra_index_urls=[], skip_editable=False, no_deps=False, output=PosixPath('stdout'), ignore_vulns=[])
Traceback (most recent call last):
  File "/Users/perezt1/.local/share/rtx/installs/python/3.10.6/bin/pip-audit", line 8, in <module>
    sys.exit(audit())
  File "/Users/perezt1/.local/share/rtx/installs/python/3.10.6/lib/python3.10/site-packages/pip_audit/_cli.py", line 449, in audit
    for spec, vulns in auditor.audit(source):
  File "/Users/perezt1/.local/share/rtx/installs/python/3.10.6/lib/python3.10/site-packages/pip_audit/_audit.py", line 67, in audit
    for dep, vulns in self._service.query_all(specs):
  File "/Users/perezt1/.local/share/rtx/installs/python/3.10.6/lib/python3.10/site-packages/pip_audit/_service/interface.py", line 155, in query_all
    yield self.query(spec)
  File "/Users/perezt1/.local/share/rtx/installs/python/3.10.6/lib/python3.10/site-packages/pip_audit/_service/pypi.py", line 61, in query
    response: requests.Response = self.session.get(url=url, timeout=self.timeout)
  File "/Users/perezt1/.local/share/rtx/installs/python/3.10.6/lib/python3.10/site-packages/requests/sessions.py", line 600, in get
    return self.request("GET", url, **kwargs)
  File "/Users/perezt1/.local/share/rtx/installs/python/3.10.6/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/perezt1/.local/share/rtx/installs/python/3.10.6/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "/Users/perezt1/.local/share/rtx/installs/python/3.10.6/lib/python3.10/site-packages/cachecontrol/adapter.py", line 48, in send
    cached_response = self.controller.cached_request(request)
  File "/Users/perezt1/.local/share/rtx/installs/python/3.10.6/lib/python3.10/site-packages/cachecontrol/controller.py", line 155, in cached_request
    resp = self.serializer.loads(request, cache_data, body_file)
  File "/Users/perezt1/.local/share/rtx/installs/python/3.10.6/lib/python3.10/site-packages/cachecontrol/serialize.py", line 95, in loads
    return getattr(self, "_loads_v{}".format(ver))(request, data, body_file)
  File "/Users/perezt1/.local/share/rtx/installs/python/3.10.6/lib/python3.10/site-packages/cachecontrol/serialize.py", line 190, in _loads_v4
    return self.prepare_response(request, cached, body_file)
  File "/Users/perezt1/.local/share/rtx/installs/python/3.10.6/lib/python3.10/site-packages/cachecontrol/serialize.py", line 141, in prepare_response
    return HTTPResponse(body=body, preload_content=False, **cached["response"])
TypeError: HTTPResponse.__init__() got an unexpected keyword argument 'strict'

Platform information

  • pip-audit version (pip-audit -V): pip-audit 2.5.2
  • Python version (python -V or python3 -V): Python 3.10.6
  • pip version (pip -V or pip3 -V): pip 23.1.2
@Tomperez98 Tomperez98 added the bug-candidate Might be a bug. label May 17, 2023
@woodruffw
Copy link
Member

Thanks for the report @Tomperez98!

From your report: you're running an old version of pip-audit, one that contains known bugs. In particular, this bug was fixed with #605 with release 2.5.5.

xref pypa/gh-action-pip-audit#38

@woodruffw woodruffw closed this as not planned Won't fix, can't repro, duplicate, stale May 17, 2023
@woodruffw woodruffw added duplicate This issue or pull request already exists and removed bug-candidate Might be a bug. labels May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants