Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Key #47

Open
bfelds opened this issue Oct 13, 2016 · 9 comments
Open

API Key #47

bfelds opened this issue Oct 13, 2016 · 9 comments

Comments

@bfelds
Copy link

bfelds commented Oct 13, 2016

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

@scopenco
Copy link
Contributor

Ok, I have to look at this in future.

@mitjmcc
Copy link

mitjmcc commented Jan 19, 2017

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.

@scopenco
Copy link
Contributor

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

@mitjmcc
Copy link

mitjmcc commented Jan 19, 2017

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

So the API key is technically partially supported.

@fstefanov
Copy link

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

@cowlinator
Copy link

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
Copy link

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.

@zhucc
Copy link

zhucc commented May 16, 2018

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

@allburov
Copy link
Contributor

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')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants