And*_*ujo 6 python python-packaging python-poetry google-artifact-registry
使用Artifactory(https://cloud.google.com/artifact-registry)我打算添加对诗歌的依赖(https://python-poetry.org/docs/repositories/)。
我可以使用命令安装:(pip install --index-url https://us-central1-python.pkg.dev/<PROJECT_ID>/<SOME_LIB_REPO>/simple/ <PACKAGE_NAME>使用 keyrings.google-artifactregistry-auth 进行身份验证)
我打算使用 POETRY 来管理我的依赖项。我不知道使用诗歌是否会增加这种依赖性。poetry add --source <PACKAGE_NAME> https://us-central1-python.pkg.dev/<PROJECT_ID>/<SOME_LIB_REPO>我收到此错误:
poetry update
Updating dependencies
Resolving dependencies... (0.9s)
RepositoryError
401 Client Error: Unauthorized for url: https://us-central1-python.pkg.dev/<PROJECT_ID>/<SOME_LIB_REPO>/simple/pytest/
Run Code Online (Sandbox Code Playgroud)
我的 pyproject.toml
...
[[tool.poetry.source]]
name = "SOME_LIB"
url = " https://us-central1-python.pkg.dev/<PROJECT_ID>/<SOME_LIB_REPO>/simple/"
secondary = true
Run Code Online (Sandbox Code Playgroud)
这里有如何使用 PIP/VIRTUALENV 进行配置的详细信息:https://cloud.google.com/artifact-registry/docs/python/authentication但没有有关 Poetry 的详细信息。
您对此有什么建议吗?
你RepositoryError的
401 客户端错误:未经授权的网址:https://us-central1-python.pkg.dev/ <PROJECT_ID>/<SOME_LIB_REPO>/simple/pytest/
明确表明您缺乏对所提及 URL 的授权。因此,您需要确保正确获取和使用授权,也就是说,您将拥有一个拥有凭据的用户,该用户实际上有权访问它。
一旦您获得了该信息,您将需要进行身份验证,以便您向其发送请求的服务器将能够确定您是谁,从而授予您适当的访问权限。阅读: https: //python-poetry.org/docs/repositories/#configuring-credentials
该页面提供了
poetry config http-basic.foo <username> <password>
Run Code Online (Sandbox Code Playgroud)
例如,解释您可以为特定存储库设置一些凭据。您可以仅指定用户名,但每当您尝试访问该 URL 时,系统都会提示您输入密码。
您还可以通过在命令中添加--username和来发布。--password您还可以指定环境变量,例如
export POETRY_PYPI_TOKEN_PYPI=my-token
export POETRY_HTTP_BASIC_PYPI_USERNAME=<username>
export POETRY_HTTP_BASIC_PYPI_PASSWORD=<password>
Run Code Online (Sandbox Code Playgroud)
请参阅https://python-poetry.org/docs/configuration/#using-environment-variables
无论如何,该错误告诉您,您没有通过所需的凭据进行正确的身份验证,因此您要么没有凭据,要么它们不正确,要么您缺乏特权。
| 归档时间: |
|
| 查看次数: |
1090 次 |
| 最近记录: |