-
Notifications
You must be signed in to change notification settings - Fork 54
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
Example doesn't work as expected #46
Comments
Hello, I have the same issue here, I'm working with the SaaS solution (https://$mycompany.jfrog.io/..). Thanks! |
Same, just started looking into Python API clients for artifactory :( |
I am also facing the same issue. |
I was looking to use this library for work also, but am seeing this same issue. Looks to me like the library is not parsing the path given to ArtifactoryPath function correctly. When I look at the error output, I can see '/api/storage' is placed at the start of the url call. It needs to be placed between the Artifactory server url and the remaining path in Artifactory to search. Looking into how this library is getting the base URI, that seems to be why it is not working, atleast for me.
Using /artifactory/ as a splitting point doesn't work in all cases since you don't know what the server's URI is going to be. This is assuming information about how Artifactory was set up. If your Artifactory server URI does not contain /artifactory/ at the end of the URI this library does not work. The example in this case fails to mention the path |
I did some more digging around. Looks like support for custom base URIs was added, but only when using the config file. This work was done in commit 2f1656a. The README needs to be updated to tell users about this functionality of the config file. |
I have just spent an hour trying to figure this out, we also use the SaaS version. Thank you @thaney071 for pointing to that commit! For anyone else who comes across this issue and doesn't want to rely on a import artifactory
artifactory.global_config = {
'https://my_company.jfrog.io/my_artifactory': {
'username': None,
'verify': True,
'cert': None,
'password': None
}
} artifactory skips reading the config if it is set in advance. Obviously this is implementation-dependant, so make sure you fix your dependency to the version of artifactory ( A slightly more robust solution is to set the config path (in my case a file the script's directory), and call the read method: from os import path
import artifactory
artifactory.default_config_path = path.abspath(
path.join(path.dirname(__file__), '.artifactory_python.cfg')
)
artifactory.read_global_config(artifactory.default_config_path) But I just went with setting artifactory.global_config in the end. |
@al4 : You mention "so make sure you fix your dependency to the version of artifactory" - is there a place to find this information ? |
@alainchiasson I was referring to the python package version, so the place to find it would be: https://pypi.python.org/pypi/artifactory To clarify, the solution relies on an implementation detail of the artifactory package, thus to avoid a future version breaking it, you should ensure you always use a version that you've tested with. Usually this would be done by putting If your code isn't in a python package or you don't fix the version, and a future version of artifactory breaks this solution (e.g. by renaming or refactoring It's not in any way essential, but it does guarantee that a future release of artifactory won't break your build. http://blog.danlew.net/2015/09/09/dont-use-dynamic-versions-for-your-dependencies/ is a good read on the subject. |
Thanks for the followup. As for myself - adding |
Hi I am newbie to python, I am trying to find out where is this file "artifactory_python.cfg" located in windows machine , will this file auto created when i do pip install or do i have to manually create this file at a specific location on my windows machine so that python can automatically use it. Any answers are much appreciated , I have a requirement to upload binaries to artifactory using python scripts. |
@rsgoud you will have to manually create |
I'm trying to use this module using the following trivial code (taken from examples):
Note, we use JFrog Artifactory as a SaaS. Without any config file (i.e.
~/.artifactory_python.cfg
) it gives me the following error:If I'm going to add the config file:
it throws another error:
I would really appreciate if someone point me on my mistake, but actually I think it is a bug…
PS. As one may notice, I'm using Python 3.5, with
pathlib
builtin.The text was updated successfully, but these errors were encountered: