You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
403 error when using private myget repository #5651
I am on the most recent pre-release version 1.2.0b1
I have searched the issues of this repo and believe that this is not a duplicate.
If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
OS version and name: Fedora Workstation 35
Poetry version: 1.2.0b1
Link of a Gist with the contents of your pyproject.toml file: pyproject.toml
Issue
Myget uses basic authentication for the repository but hands back CDN download links that include the authentication as part of the URL.
When poetry attempts to download the file it's still using the same session it used to hit myget in the first place, which includes the basic auth headers. This causes the CDN to return a 403 error, similar to the below:
403 Client Error: Forbidden for url: https://az774065.vo.msecnd.net/redacted/redacted-2.0.6-py3-none-any.whl?sv=2015-12-11&sr=b&sig=5xCEJnyQXzUqK0ECzoABMH1vdVxPRCW0Yqzv7VqE8Yg%3D&st=2022-05-20T03%3A55%3A00Z&se=2022-05-20T05%3A05%3A00Z&sp=r&rscc=max-age%3D3600&rsct=binary%2Foctet-stream&rscd=filename%3Dredacted-2.0.6-py3-none-any.whl
The same repository works just fine with pip so it should be working in poetry.
I can think of two solutions to this:
Have poetry transparently catch the first 403 and re-try without the auth headers. This is hacky but works (I tried it locally). The downside being that it may cause undesired behaviour for other repos.
Add a flag to the repo in the pyproject.toml file that instructs poetry to not use the basic auth headers to download the packages. (I had a crack at this one, but the semantics of how poetry parses the pyproject.toml file is a bit beyond me)
The git version still doesn't work, but in a new way.
(.venv) [daniel@dv-xps-fedora Davis_state_consumer]$ poetry@git add --source myget 'tymetrics'
Using version ^2.0.6 for redacted
Updating dependencies
Resolving dependencies... (4.2s)
HTTPError
404 Client Error: Not Found for url: https://pypi.org/pypi/redacted/json/
at ~/.local/pipx/venvs/poetry@git/lib64/python3.10/site-packages/requests/models.py:960 in raise_for_status
956│ elif 500 <= self.status_code < 600:
957│ http_error_msg = u'%s Server Error: %s for url: %s' % (self.status_code, reason, self.url)
958│
959│ if http_error_msg:
→ 960│ raise HTTPError(http_error_msg, response=self)
961│
962│ def close(self):
963│ """Releases the connection back to the pool. Once this method has been
964│ called the underlying ``raw`` object must not be accessed again.
@voney looks like your source was searched, nothing found and then PyPI was looked at. You can try with -vvv for more information. To see if you actually got redirected to the correct package. It could also be that the credentials are not set correctly perhaps for your main repo?
Activity
abn commentedon May 20, 2022
With recent changes this might have already been resolved. Can you test the version from master?
See these issues for more information: #5518
Install Poetry from VCS
pipx install --force --suffix=@git 'poetry @ git+https://github.com/python-poetry/poetry.git'voney commentedon May 25, 2022
Apologies for the delay in testing.
The git version still doesn't work, but in a new way.
That's after adding the myget repo using:
abn commentedon May 25, 2022
@voney looks like your source was searched, nothing found and then PyPI was looked at. You can try with
-vvvfor more information. To see if you actually got redirected to the correct package. It could also be that the credentials are not set correctly perhaps for your main repo?voney commentedon May 25, 2022
Ok so it looks like maybe the dependency solver isn't correctly getting additional packages from the private repo. Take a look.
For context here, I'm installing
redactedwhich repends onredacted_dependencywhich is also in themygetrepo.abn commentedon May 25, 2022
Conversation moved to #5682.
github-actions commentedon Mar 2, 2024
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.