【问题标题】:provide header to pip install command为 pip install 命令提供标头
【发布时间】:2021-01-18 11:16:27
【问题描述】:

我有一个本地 Artifactory 存储库,我希望向我的用户提供 URL,以便他们能够安装轮子。它们本身不是 Artifשבtory 的一部分,所以我正在考虑使用 API KEY。根据文档-

our API key can be used to authenticate you when using the REST API.
To use the API key, add the following header to all REST API calls: 'X-JFrog-Art-Api: <YOUR_API_KEY>'

我有我的命令pip install https://artifactory.myorg.com:443/artifactory/local-pypi-mywork-01/mypackage-0.1-py3-none-any.whl

有没有办法将 API 密钥作为此 URL 请求的标头提供?

【问题讨论】:

    标签: pip artifactory pypi


    【解决方案1】:

    不完全是你问的,但也许提供了一个解决方案:

    pip install https://<username>:<api-key>@artifactory.myorg.com:443/artifactory/local-pypi-mywork-01/mypackage-0.1-py3-none-any.whl
    

    但是,更推荐使用访问令牌。访问令牌是可过期的,并且通常更受限制。 您可以轻松创建access tokens with the JFrog CLI

    jfrog rt access-token-create froggy-user
    

    然后:

    pip install https://froggy-user:<token>@artifactory.myorg.com:443/artifactory/local-pypi-mywork-01/mypackage-0.1-py3-none-any.whl
    

    【讨论】:

      猜你喜欢
      • 2021-03-25
      • 1970-01-01
      • 2020-10-13
      • 2021-09-13
      • 1970-01-01
      • 2022-06-15
      • 1970-01-01
      • 1970-01-01
      • 2016-02-27
      相关资源
      最近更新 更多