Skip to main content

A Python to Artifactory interface

Project description

# Python interface library for Jfrog Artifactory #

[![Build Status](https://travis-ci.org/Parallels/artifactory.svg?branch=develop)](https://travis-ci.org/Parallels/artifactory)

This module is intended to serve as a logical descendant of [pathlib](https://docs.python.org/3/library/pathlib.html), 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().

# Usage Examples #

## Walking Directory Tree ##

Getting directory listing:

```python
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:

```python
from artifactory import ArtifactoryPath
path = ArtifactoryPath(
"http://repo.jfrog.org/artifactory/distributions/org/")

for p in path.glob("**/*.gz"):
print p
```

## Downloading Artifacts ##

Download artifact to a local filesystem:

```python
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())
```

## Uploading Artifacts ##

Deploy a regular file ```myapp-1.0.tar.gz```

```python
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```

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

## SSL Cert Verification Options ##
See [Requests - SSL verification](http://docs.python-requests.org/en/latest/user/advanced/#ssl-cert-verification) for more details.

```python
from artifactory import ArtifactoryPath
path = ArtifactoryPath(
"http://my-artifactory/artifactory/libs-snapshot-local/myapp/1.0")
```
... is the same as
```python
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

```python
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

```python
from artifactory import ArtifactoryPath
path = ArtifactoryPath(
"http://my-artifactory/artifactory/libs-snapshot-local/myapp/1.0",
verify=False)
```

**Note:** If host cert verification is disabled urllib3 will throw a [InsecureRequestWarning](https://urllib3.readthedocs.org/en/latest/security.html#insecurerequestwarning).
To disable these warning, one needs to call urllib3.disable_warnings().
```python
import requests.packages.urllib3 as urllib3
urllib3.disable_warnings()
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

artifactory-0.1.7.tar.gz (10.4 kB view details)

Uploaded Source

File details

Details for the file artifactory-0.1.7.tar.gz.

File metadata

  • Download URL: artifactory-0.1.7.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for artifactory-0.1.7.tar.gz
Algorithm Hash digest
SHA256 9f53f3c77d78fbd6af54601f924d4ec17f645b46f395235ea5339ed46c059098
MD5 a99e537a02fd7fe6710ff80378c94d22
BLAKE2b-256 d4026ce44cb4045b096f63c36aab0bfa901ecf2f8ab1ce04a3ca5ff82e8cbf57

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page