Usage

Authentication

Artifactory servers can allow anonymous access by logging in with a fixed pair of 'anonymous' as username and '' as password. This is the default behavior of audfactory.

import audfactory

audfactory.authentification('https://artifactory.domain.com/artifactory')
('anonymous', '')

To access an Artifactory server that requires logging in with a username and password, store your username and API key in ~/.artifactory_python.cfg using separate sections for every server. Every section is marked by the server URL in square brackets without the https:// or http:// at the beginning:

[artifactory1.domain.com/artifactory]
username = MY_USERNAME1
password = MY_API_KEY1

[artifactory2.domain.com/artifactory]
username = MY_USERNAME2
password = MY_API_KEY2

When authentication is requested for a configured server URL, the corresponding username and password pair is returned.

audfactory.authentification('https://artifactory2.domain.com/artifactory')
('MY_USERNAME2', 'MY_API_KEY2')

Anonymous access is still used for every server not listed in the file.

audfactory.authentification('https://artifactory3.domain.com/artifactory')
('anonymous', '')

Alternatively, you can export the credentials as environment variables:

export ARTIFACTORY_USERNAME="MY_USERNAME"
export ARTIFACTORY_API_KEY="MY_API_KEY"

The environment variables will be applied to all servers, which means you need to have the same username and API key on every server. You might lose access to artifacts on servers that are setup for anonymous access as it will always try to authenticate with the given username and password. In this case it is recommended to not use the environment variables.

Artifactory

Artifacts are stored under the following name space on Artifactory:

  • group_id: group ID of an artifact, e.g. 'com.audeering.models'

  • name: name of an artifact, e.g. 'timit'

  • version: version of an artifact, e.g. 1.0.1

Those three parts are arguments to most of the functions inside audfactory.

Examples

You can query the available versions of an artifact:

import audfactory

audfactory.versions(
    'https://audeering.jfrog.io/artifactory',
    'data-public',
    'emodb',
    'db',
)
['1.1.0', '1.1.1', '1.2.0', '1.3.0', '1.4.0', '1.4.1']