问题
I have a requirement where any file should be put in the artifact using python language. I tried to search all over internet but I couldn't find any help.
Please share code snippet or something which can help me to achieve this.
Any help is greatly appreciated here.
回答1:
Artifactory python module can be used to upload artifacts into artifactory. https://pypi.python.org/pypi/artifactory/0.1.17
Here is an example from the website used to upload a file into artifactory:
from artifactory import ArtifactoryPath
path = ArtifactoryPath("http://my-artifactory/artifactory/libs-snapshotlocal/myapp/1.0")
path.mkdir()
path.deploy_file('./myapp-1.0.tar.gz')
回答2:
The defend against fruit project provides the integration with Artifactory and Python you are looking for. http://teamfruit.github.io/defend_against_fruit/
回答3:
Artifactory exposes a REST API. Here's a link to the documentation. See the section on "Deploy Artifact".
Basically you will need to build a REST client. There might already exist one for Artifactory? If you need to write it yourself there is a WADL file that might make things easier (see also wadllib).
来源:https://stackoverflow.com/questions/11514693/how-to-put-any-file-in-artifactory-using-python