Closed briner closed 3 years ago
This is not a bug in the BaseUrlSession
, it's a bug in the fact that you've made assumptions that are invalid because of how URL Relative Resolution is defined in RFC 3986 and is implemented in the standard library. Observe:
Python 3.9.1 (default, Jan 20 2021, 00:00:00)
[GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from urllib.parse import urljoin
>>> urljoin("https://an.domain-name.com/images/", "sha256:102ab2db1ad671545c0ace25463c4e3c45f9b15e319d3a00a1b2b085293c27fb")
'sha256:102ab2db1ad671545c0ace25463c4e3c45f9b15e319d3a00a1b2b085293c27fb'
And we rely on that https://github.com/requests/toolbelt/blob/26fe2b3e23f6d766e3db22dffe1c0a1e992c1f70/requests_toolbelt/sessions.py#L68-L70
You could use "./sha256:102ab2db1ad671545c0ace25463c4e3c45f9b15e319d3a00a1b2b085293c27fb"
instead to get the behaviour you want
happy, to have found a solution.
Many thank for your help and your time.
Regards
I have the impression that the base_url is not working as expected
So giving the subpath
sha256:102ab2db1ad671545c0ace25463c4e3c45f9b15e319d3a00a1b2b085293c27fb
for thesession.get
make it fail !the versions: