Skip to main content

Typed interactions with the Jfrog Artifactory REST API

Project description


GitHub Actions workflow PyPI version Codacy Badge Codacy Badge Code style: black

pyartifactory is a Python library to access the Artifactory REST API.

This library enables you to manage Artifactory resources such as users, groups, permissions, repositories, artifacts and access tokens in your applications. Based on Python 3.6+ type hints.


  • Python 3.6+


pip install pyartifactory 



from pyartifactory import Artifactory
art = Artifactory(url="ARTIFACTORY_URL", auth=('USERNAME','PASSWORD_OR_API_KEY'))

SSL Cert Verification Options

Specify a local cert to use as client side certificate

from pyartifactory import Artifactory
art = Artifactory(url="ARTIFACTORY_URL", auth=('USERNAME','PASSORD_OR_API_KEY'), cert="/path_to_file/server.pem")

Disable host cert verification

from pyartifactory import Artifactory
art = Artifactory(url="ARTIFACTORY_URL", auth=('USERNAME','PASSORD_OR_API_KEY'), verify=False)

Admin objects


First, you need to create a new Artifactory object.

from pyartifactory import Artifactory
art = Artifactory(url="ARTIFACTORY_URL", auth=('USERNAME','PASSORD_OR_API_KEY'))

Get the list of users:

users = art.users.list()

Get a single user:

user = art.users.get("test_user")

Create a user:

from pyartifactory.models import NewUser

# Create User
user = NewUser(name="test_user", password="test_password", email="")
new_user = art.users.create(user)

# Update user = ""
updated_user = art.users.update(user)

Update a user:

from pyartifactory.models import User

user = art.users.get("test_user")

# Update user = ""
updated_user = art.users.update(user)

Delete a user:


Unlock a user:



Get the list of groups:

users = art.groups.list()

Get a single group:

users = art.groups.get("group_name")

Create/Update a group:

from pyartifactory.models import Group

# Create a Group
group = Group(name="test_group", description="test_group")
new_group = art.groups.create(group)

# Update user
group.description = "test_group_2"
updated_group = art.groups.update(group)

Delete a group:



A set of methods for performing operations on apiKeys, passwords ...


Create an access token (for a transient user):

token ='transient_artifactory_user', 
                                         groups=['g1', 'g2'],

Create an access token for an existing user (groups are implied from the existing user):

token ='existing_artifactory_user', 

Revoke an existing revocable token:


Get the list of repositories:

repositories = art.repositories.list()

Get a single repository

repo = art.repositories.get_repo("repo_name")
# According to the repo type, you'll have either a local, virtual or remote repository returned

Create/Update a repository:

from pyartifactory.models import LocalRepository, VirtualRepository, RemoteRepository

# Create local repo
local_repo = LocalRepository(key="test_local_repo")
new_local_repo = art.repositories.create_repo(local_repo)

# Create virtual repo
virtual_repo = VirtualRepository(key="test_virtual_repo")
new_virtual_repo = art.repositories.create_repo(virtual_repo)

# Create remote repo
remote_repo = RemoteRepository(key="test_remote_repo")
new_remote_repo = art.repositories.create_repo(remote_repo)

# Update a repository
local_repo = art.repositories.get_repo("test_local_repo")
local_repo.description = "test_local_repo"
updated_local_repo = art.repositories.update_repo(local_repo)

Delete a repository:



Get the list of permissions:

permissions = art.permissions.list()

Get a single permission:

users = art.permissions.get("test_permission")

Create/Update a permission:

from pyartifactory.models import Permission

# Create a permission
permission = Permission(
        "name": "test_permission",
        "repositories": ["test_repository"],
        "principals": {
            "users": {"test_user": ["r", "w", "n", "d"]},
            "groups": {"developers": ["r"]},
perm = art.permissions.create(permission)

# Update permission
permission.repositories = ["test_repository_2"]
updated_permission = art.permissions.update(permission)

Delete a permission:



Deploy an artifact

artifact = art.artifacts.deploy("<LOCAL_FILE_LOCATION>", "<ARTIFACT_PATH_IN_ARTIFACTORY>")
# artifact = art.artifacts.deploy("Desktop/myNewFile.txt", "my-repository/my/new/artifact/directory/file.txt")

Download an artifact

# artifact ="my-artifactory-repository/my/new/artifact/file.txt", "Desktop/my/local/directory")
# The artifact location is returned by the download method
# If you have not set a <LOCAL_DIRECTORY_PATH>, the artifact will be downloaded in the current directory

Retrieve artifact properties

artifact_properties ="<ARTIFACT_PATH_IN_ARTIFACTORY>")
# artifact_properties ="my-repository/my/new/artifact/directory/file.txt")
>>> print(artifact_properties.json)

Retrieve artifact stats

artifact_stats = art.artifacts.stats("<ARTIFACT_PATH_IN_ARTIFACTORY>")
# artifact_stats = art.artifacts.stats("my-repository/my/new/artifact/directory/file.txt")
>>> print(artifact_stats.json)

Copy artifact to a new location


# If you want to run a dryRun test, you can do the following:
# artifact = art.artifacts.copy("my-repository/current/artifact/path/file.txt","my-repository/new/artifact/path/file.txt", dryrun=True)
# It will return properties of the newly copied artifact

Move artifact to a new location


# You can also run a dryRun test with the move operation
# It will return properties of the newly moved artifact

Delete an artifact



Please read the Development - Contributing guidelines.

Project details

Download files

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

Files for pyartifactory, version 1.4.0
Filename, size File type Python version Upload date Hashes
Filename, size PyArtifactory-1.4.0-py3-none-any.whl (15.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size PyArtifactory-1.4.0.tar.gz (16.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page