简体   繁体   中英

How to publish python packages to internal artifactory in poetry using a token

I am using poetry version 1.1.6 to build and publish my project to an internal artifactory.

I have provided the below command and configured the repository.

poetry config repositories.myrepo https://my-internal-artifactory/api/pypi/python/simple

How do I configure API token for an internal repository?

I tried this

poetry config http-basic.myrepo mytoken

Its still prompting for password assuming that I am providing a username and password. However, all I have is a token. I don't have a username and password.

The docs doesn't seem to provide sufficient information for private repositories using tokens,

Note: Before poetry, we were using curl to upload to artifactory using the token.

How do we publish to private repositories with token in poetry? Is it even possible to do this? Any help would be greatly appreciated.

The http-basic config is for user + password combination, you're only providing one of them. There's another configuration setting called pypi-token , you probably want to use this instead (more information in the credentials section of poetry ). In your case it should be poetry config pypi-token.myrepo mytoken

Make sure that you haven't specified both http-basic and pypi-token , as just one of them will work - i belive poetry will check for pypi-token and if that is present it will use that. Just use poetry config --unset to remove the other config option.

My problem was I wanted to publish to Artifactory , where you have a token but you also have a user, in that case you need to use the http-basic option and specify both your user and your token as the password.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM