Skip to content

Commit

Permalink
Fix setting verify for requests
Browse files Browse the repository at this point in the history
Due to bug psf/requests#3829,
setting 'verify' on session doesn't work if REQUESTS_CA_BUNDLE
is set on environment. The bundle defined via REQUESTS_CA_BUNDLE
will take precedence and the custom bundle provided via 'verify'
is ignored.

Let's now set 'verify' for each request.

This can be revetrted when the bug is fixed, likely in
python-requests-v3.
  • Loading branch information
rbikar committed Oct 29, 2023
1 parent c7c2bd0 commit d0d0535
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ubipop/_cdn.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ def _session(self):
return self._tls.session

def _head(self, *args, **kwargs):
# set verify for each request
# verify set on session doesn't work due to https://github.com/psf/requests/issues/3829
# if REQUESTS_CA_BUNDLE is set on env, it takes precedence
kwargs["verify"] = self._session.verify
return self._session.head(*args, **kwargs)

def _on_failure(self, header, exception):
Expand Down

0 comments on commit d0d0535

Please sign in to comment.