artifactory icon indicating copy to clipboard operation
artifactory copied to clipboard

API Key

Open bfelds opened this issue 8 years ago • 9 comments

It would be great if this supported the API key in addition to username/pw

bfelds avatar Oct 13 '16 21:10 bfelds

Ok, I have to look at this in future.

scopenco avatar Oct 14 '16 13:10 scopenco

Has there been any attempts at adding this enhancement?

And if not, any suggestions as to where to start looking to implement this?

I am fairly unfamiliar with the source of the project, but would still like to assist in adding this feature.

mitjmcc avatar Jan 19 '17 15:01 mitjmcc

No any attempts/PRs. You can start from Artifactory docs like https://www.jfrog.com/confluence/display/RTF/Updating+Your+Profile#UpdatingYourProfile-APIKey

scopenco avatar Jan 19 '17 15:01 scopenco

I was actually able to deploy a file by using my API key as a password.

So the API key is technically partially supported.

mitjmcc avatar Jan 19 '17 15:01 mitjmcc

@mitjmcc Using API key instead of password inside ~/.artifactory_python.cfg not working for me.

fstefanov avatar Apr 21 '17 22:04 fstefanov

I was able to use my API key by adding it as the password in the auth argument for ArtifactoryPath. artifactory.ArtifactoryPath(url, auth=("me", "big_long_api_key")) However, it doesn't seem to work with ~/.artifactory_python.cfg.
Even though the artifactory.global_config variable has all of the correct data, the return value of path = artifactory.ArtifactoryPath(url) has None for path.auth

cowlinator avatar Sep 27 '17 03:09 cowlinator

My issue turned out to be due to the fact that the module is very exacting in how it expects the url in the config file to be represented.

I had used [https://artifactory.mycompany.com/artifactory/] in my .artifactory_python.cfg, but the module expected it to be [https://artifactory.mycompany.com/artifactory] without the trailing slash.

This seems to be due to the way that the module parses and compares urls.

After correcting this issue, I was able to use the API key as the password.

cowlinator avatar Oct 03 '17 19:10 cowlinator

api key should add to requests headers ,eg: {"X-JFrog-Art-Api":"long_long_api_key"},I have test this with python reuqests lib. doc of jfrog show how to use api with curl: curl -H "X-JFrog-Art-Api:ABcdEF" -X PUT "http://localhost:8081/artifactory/my-repository/my/new/artifact/directory/file.txt" -T Desktop/myNewFile.txt

zhucc avatar May 16 '18 08:05 zhucc

API KEY supported in https://github.com/devopshq/artifactory#authentication

python -mpip install dohq-artifactory

from artifactory import ArtifactoryPath
path = ArtifactoryPath(
    "http://my-artifactory/artifactory/myrepo/restricted-path",
    apikey='MY_API_KEY')

allburov avatar Nov 14 '18 02:11 allburov