artifactory
artifactory copied to clipboard
API Key
It would be great if this supported the API key in addition to username/pw
Ok, I have to look at this in future.
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.
No any attempts/PRs. You can start from Artifactory docs like https://www.jfrog.com/confluence/display/RTF/Updating+Your+Profile#UpdatingYourProfile-APIKey
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 Using API key instead of password inside ~/.artifactory_python.cfg not working for me.
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
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.
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
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')