This module is intended to serve as a logical descendant of pathlib, a Python 3 module for object-oriented path manipulations. As such, it implements everything as closely as possible to the origin with few exceptions, such as stat().
Getting directory listing:
from artifactory import ArtifactoryPath
path = ArtifactoryPath("http://repo.jfrog.org/artifactory/gradle-ivy-local")
for p in path:
print p
Find all .gz files in current dir, recursively:
from artifactory import ArtifactoryPath
path = ArtifactoryPath("http://repo.jfrog.org/artifactory/distributions/org/")
for p in path.glob("**/*.gz"):
print p
Download artifact to a local filesystem:
from artifactory import ArtifactoryPath
path = ArtifactoryPath("http://repo.jfrog.org/artifactory/distributions/org/apache/tomcat/apache-tomcat-7.0.11.tar.gz")
with path.open() as fd:
with open("tomcat.tar.gz", "wb") as out:
out.write(fd.read())
Deploy a regular file myapp-1.0.tar.gz
from artifactory import ArtifactoryPath
path = ArtifactoryPath("http://my-artifactory/artifactory/libs-snapshot-local/myapp/1.0")
path.mkdir()
path.deploy_file('./myapp-1.0.tar.gz')
Deploy a debian package myapp-1.0.deb
from artifactory import ArtifactoryPath
path = ArtifactoryPath("http://my-artifactory/artifactory/ubuntu-local/pool")
path.deploy_deb('./myapp-1.0.deb', distribution='trusty', component='main', architecture='amd64')
See Requests - SSL verification for more details.
from artifactory import ArtifactoryPath
path = ArtifactoryPath("http://my-artifactory/artifactory/libs-snapshot-local/myapp/1.0")
... is the same as
from artifactory import ArtifactoryPath
path = ArtifactoryPath("http://my-artifactory/artifactory/libs-snapshot-local/myapp/1.0", verify=True)
Specify a local cert to use as client side certificate
from artifactory import ArtifactoryPath
path = ArtifactoryPath("http://my-artifactory/artifactory/libs-snapshot-local/myapp/1.0", cert="/path_to_file/server.pem")
Disable host cert verification
from artifactory import ArtifactoryPath
path = ArtifactoryPath("http://my-artifactory/artifactory/libs-snapshot-local/myapp/1.0", verify=False)
Disable host cert verification and suppress urllib3 security warnings
from artifactory import ArtifactoryPath
path = ArtifactoryPath("http://my-artifactory/artifactory/libs-snapshot-local/myapp/1.0", verify=False, urllib3_warn=False)