rtpy package¶
rtpy.__init__.py¶
Exposed objects/functions to end user.
-
class
rtpy.__init__.
Rtpy
(settings)[source]¶ Main parent class.
Attributes are the classes are the methods categories.
Parameters: settings (dict) – The user settings, mandaroty keys are “af_url” and “api_key” or “username” and “password”. -
artifacts_and_storage
¶ Category for multiple API methods
Type: rtpy.artifacts_and_storage.RtpyArtifactsAndStorage
-
buils
¶ Category for multiple API methods
Type: rtpy.builds.RtpyBuilds
-
repositories
¶ Category for multiple API methods
Type: rtpy.repositories.RtpyRepositories
-
searches
¶ Category for multiple API methods
Type: rtpy.searches.RtpySearches
-
security
¶ Category for multiple API methods
Type: rtpy.security.RtpySecurity
-
support
¶ Category for multiple API methods
Type: rtpy.support.RtpySupport
-
system_and_configuration
¶ Category for multiple API methods
Type: rtpy.system_and_configuration.RtpySystemAndConfiguration
-
settings
¶ Previously supplied settings at class instantiation
Type: dict
-
rtpy.artifacts_and_storage.py¶
Functions for the ARTIFACTS AND STORAGE REST API Methods category.
-
class
rtpy.artifacts_and_storage.
RtpyArtifactsAndStorage
(provided_settings, prefix, category)[source]¶ ARTIFACTS AND STORAGE methods category.
-
artifact_sync_download
(repo_key, artifact_path, options=None, **kwargs)[source]¶ Download an artifact.
With or without returning he actual content to the client.
When tracking the progress marks are printed (by default every 1024 bytes). This is extremely useful if you want to trigger downloads on a remote Artifactory server, for example to force eager cache population of large artifacts, but want to avoid the bandwidth consumption involved in transferring the artifacts to the triggering client. If no content parameter is specified the file content is downloaded to the client.
Parameters: - repo_key (str) – Key of the repository
- artifact_path (str) – Path of the artifact in the repository
- options (str, optional) – String of options
- **kwargs – Keyword arguments
-
copy_item
(src_repo_key, src_item_path, target_repo_key, target_item_path, options=None, **kwargs)[source]¶ Copy an artifact or a folder to the specified destination.
Supported by local repositories only.
Parameters: - src_repo_key (str) – Key of the source repository
- src_item_path (str) – Path of the item in the source repository
- target_repo_key (str) – Key of the target repository
- target_item_path (str) – Path of the item in the target repository
- options (str, optional) – String of options
- **kwargs – Keyword arguments
-
create_directory
(repo_key, directory_path, **kwargs)[source]¶ Create new directory at the specified destination.
Parameters: - repo_key (str) – Key of the repository
- directory_path (str) – Path of the directory in the repository
- **kwargs – Keyword arguments
-
delete_item
(repo_key, path_to_item, **kwargs)[source]¶ Delete a file or a folder from the specified destination.
Parameters: - repo_key (str) – Key of the repository
- path_to_item (str) – Path of the item in the repository
- **kwargs – Keyword arguments
-
delete_item_from_trash_can
(path_in_trashcan, **kwargs)[source]¶ Permanently delete an item from the trash can.
Parameters: **kwargs – Keyword arguments
-
delete_item_properties
(repo_key, item_path, properties, options=None, **kwargs)[source]¶ Delete the specified properties from an item (file or folder).
When a folder is used property removal is recursive by default. Supported by local and local-cached repositories.
Parameters: - repo_key (str) – Key of the repository
- item_path (str) – The path of the item in the repository
- properties (str) – String of properties
- options (str, optional) – String of options
- **kwargs – Keyword arguments
-
deploy_artifact
(repo_key, local_artifact_path, target_artifact_path, **kwargs)[source]¶ Deploy an artifact to the specified destination.
Parameters: - repo_key (str) – Key of the repository
- local_artifact_path (str) – Local path of the artifact to upload
- target_artifact_path (str) – Target path of the artifact in the repository
- **kwargs – Keyword arguments
-
deploy_artifact_by_checksum
(repo_key, target_artifact_path, sha_type, sha_value, **kwargs)[source]¶ Deploy an artifact to the specified destination.
By checking if the artifact content already exists in Artifactory. If Artifactory already contains a user readable artifact with the same checksum the artifact content is copied over to the new location and return a response without requiring content transfer. Otherwise, a 404 error is returned to indicate that content upload is expected in order to deploy the artifact.
Parameters: - repo_key (str) – Key of the repository
- target_artifact_path (str) – Target path of the artifact in the repository
- sha_type (str) – Type of secure hash
- sha_value (str) – Value of the secure hash
- **kwargs – Keyword arguments
-
empty_trash_can
(**kwargs)[source]¶ Empty the trash can permanently deleting all its current contents.
Parameters: **kwargs – Keyword arguments
-
file_info
(repo_key, file_path, **kwargs)[source]¶ File Info.
For virtual use the virtual repository returns the resolved file. Supported by local, local-cached and virtual repositories.
Parameters: - repo_key (str) – Key of the repository
- file_path (str) – The path of the file in the repository
- **kwargs – Keyword arguments
-
file_list
(repo_key, folder_path, options=None, **kwargs)[source]¶ Get a flat (the default) or deep listing of the files and folders.
(not included by default) within a folder For deep listing you can specify an optional depth to limit the results. Optionally include a map of metadata timestamp values as part of the result
Parameters: - repo_key (str) – Key of the repository
- folder_path (str) – Path of the folder in the repository
- options (str, optional) – String of options
- **kwargs – Keyword arguments
-
file_statistics
(repo_key, item_path, **kwargs)[source]¶ Item statistics.
Record the number of times an item was downloaded, last download date and last downloader. Supported by local and local-cached repositories.
Parameters: - repo_key (str) – Key of the repository
- item_path (str) – The path of the item in the repository
- **kwargs – Keyword arguments
-
folder_info
(repo_key, folder_path, **kwargs)[source]¶ Folder Info.
For virtual use, the virtual repository returns the unified children. Supported by local, local-cached and virtual repositories.
Parameters: - repo_key (str) – Key of the repository
- folder_path (str) – The path of the folder in the repository
- **kwargs – Keyword arguments
-
get_background_tasks
(**kwargs)[source]¶ Retrieve list of background tasks currently scheduled.
Or running in Artifactory In HA, the nodeId is added to each task. Task can be in one of few states: scheduled, running, stopped, canceled. Running task also shows the task start time.
Parameters: **kwargs – Keyword arguments
-
get_storage_summary_info
(**kwargs)[source]¶ Return storage summary information.
regarding binaries file store and repositories.
Parameters: **kwargs – Keyword arguments
-
item_last_modified
(repo_key, item_path, **kwargs)[source]¶ Retrieve the last modified item at the given path.
If the given path is a folder, the latest last modified item is searched for recursively. Supported by local and local-cached repositories.
Parameters: - repo_key (str) – Key of the repository
- item_path (str) – The path of the item in the repository
- **kwargs – Keyword arguments
-
item_properties
(repo_key, item_path, properties=None, **kwargs)[source]¶ Item Properties. Optionally return only the properties requested.
Parameters: - repo_key (str) – Key of the repository
- item_path (str) – The path of the item in the repository
- properties (str) – String of properties
- **kwargs – Keyword arguments
-
move_item
(src_repo_key, src_item_path, target_repo_key, target_item_path, options=None, **kwargs)[source]¶ Move an artifact or a folder to the specified destination.
Supported by local repositories only.
Parameters: - src_repo_key (str) – Key of the source repository
- src_item_path (str) – Path of the item in the source repository
- target_repo_key (str) – Key of the target repository
- target_item_path (str) – Path of the item in the target repository
- options (str, optional) – String of options
- **kwargs – Keyword arguments
-
optimize_system_storage
(**kwargs)[source]¶ Raise a flag to invoke balancing between redundant storage units.
Of a sharded filestore following the next garbage collection.
-
restore_item_from_trash_can
(path_in_trashcan, target_path, **kwargs)[source]¶ Restore an item from the trash can.
Parameters: - path_in_trashcan (str) – Path of the item in the trashcan (repo_name/folder/file)
- target_path (str) – Where to restore the item (repo_name/folder/file)
-
retrieve_artifact
(repo_key, artifact_path, **kwargs)[source]¶ Retrieve an artifact from the specified destination.
Parameters: - repo_key (str) – Key of the repository
- artifact_path (str) – Path of the artifact in the repository
- **kwargs – Keyword arguments
-
retrieve_folder_or_repository_archive
(repo_key, path, archive_type, include_checksums=False, **kwargs)[source]¶ Retrieve an archive file (supports zip/tar/tar.gz/tgz).
containing all the artifacts that reside under the specified path (folder or repository root). Requires Enable Folder Download to be set.
Parameters: - repo_key (str) – Key of the repository
- path (str) – Path of the folder in the repository
- archive_type (str) – Type of archive
- include_checksums (bool, optional) – True to include checksums, False by default
- **kwargs – Keyword arguments
-
set_item_properties
(repo_key, item_path, properties, options=None, **kwargs)[source]¶ Attach properties to an item (file or folder).
When a folder is used property attachment is recursive by default. Supported by local and local-cached repositories
Parameters: - repo_key (str) – Key of the repository
- item_path (str) – The path of the item in the repository
- properties (str) – String of properties
- options (str, optional) – String of options
- **kwargs – Keyword arguments
-
set_item_sha256_checksum
(params, **kwargs)[source]¶ Calculate an artifact’s SHA256 checksum and attaches it as a property.
(with key “sha256”). If the artifact is a folder, then recursively calculates the SHA256 of each item in the folder and attaches the property to each item.
Parameters: - params (dict) – Dictionary comprised of {“repo_key”: str, “path”: str}
- **kwargs – Keyword arguments
-
trace_artifact_retrieval
(repo_key, item_path, **kwargs)[source]¶ Simulate an artifact retrieval request from the specified.
location and returns verbose output about the resolution process.
Parameters: - repo_key (str) – Key of the repository
- item_path (str) – The path of the item in the repository
- **kwargs – Keyword arguments
-
rtpy.builds.py¶
Functions for the BUILDS REST API Methods category.
rtpy.import_and_export.py¶
Functions for the IMPORT AND EXPORT REST API Methods category.
rtpy.plugins.py¶
Functions for the PLUGINS REST API Methods category.
rtpy.repositories.py¶
Functions for the REPOSITORIES REST API Methods category.
-
class
rtpy.repositories.
RtpyRepositories
(provided_settings, prefix, category)[source]¶ REPOSITORIES methods category.
-
calculate_bower_index
(repo_key, **kwargs)[source]¶ Recalculate the index for a Bower repository.
Parameters: - repo_key (str) – Key of the repository
- **kwargs – Keyword arguments
-
calculate_conda_repository_metadata
(repo_key, options=None, **kwargs)[source]¶ Calculate/recalculate the Conda packages and release metadata for a repository.
The calculation can be synchronous (the default) or asynchronous. Please refer to Conda Repositories for more details. Supported for local repositories only
Parameters: - repo_key (str) – Key of the repository
- options (str) – String of options
- **kwargs – Keyword arguments
-
calculate_cran_repository_metadata
(repo_key, options=None, **kwargs)[source]¶ Calculates/recalculates the Packages and Release metadata for a repository.
Based on the CRAN packages in it. The calculation can be synchronous (the default) or asynchronous. Please refer to CRAN Repositories for more details. Supported by local repositories only. From version 6.1, by default, the recalculation process also writes several entries from the CRAN package’s metadata as properties on all of the artifacts (based on the control file’s content).
Parameters: - repo_key (str) – Key of the repository
- options (str) – String of options
- **kwargs – Keyword arguments
-
calculate_debian_repository_metadata
(repo_key, x_gpg_passphrase=None, options=None, **kwargs)[source]¶ Calculate/recalculate the Packages and Release metadata.
for this repository, based on the Debian packages in it. Calculation can be synchronous (the default) or asynchronous. Please refer to Debian Repositories for more details. Supported by local repositories only. From version 4.4, by default, the recalculation process also writes several entries from the Debian package’s metadata as properties on all of the artifacts (based on the control file’s content). This operation may not always be required (for example, if the Debian files are intact and were not modified, only the index needs to be recalculated. The operation is resource intensive and can be disabled by passing the ?writeProps=0 query param. From version 5.7, the target repository can be a virtual repository.
Parameters: - repo_key (str) – Key of the repository
- x_gpg_passphrase (str) – Passphrase
- options (str) – String of options
- **kwargs – Keyword arguments
-
calculate_helm_chart_index
(repo_key, **kwargs)[source]¶ Calculate Helm chart index on the specified path.
(local repositories only).
Parameters: - repo_key (str) – Key of the repository
- **kwargs – Keyword arguments
-
calculate_maven_index
(options, **kwargs)[source]¶ Calculates/caches a Maven index for the specified repositories.
For a virtual repository specify all underlying repositories that you want the aggregated index to include. Calculation can be forced, which for remote repositories will cause downloading of a remote index even if a locally ached index has not yet expired; and index recalculation based on the cache on any failure to download the remote index, including communication errors (the default behavior is to only use the cache when a remote index cannot be found and returns a 404). Forcing has no effect on local repositories index calculation.
Parameters: - options (str) – String of options
- **kwargs – Keyword arguments
-
calculate_maven_metadata
(repo_key, folder_path, options=None, **kwargs)[source]¶ Calculate Maven metadata on the specified path.
(local repositories only).
Parameters: - repo_key (str) – Key of the repository
- folder_path (str) – Path of the folder in the repository
- options (str) – String of options
- **kwargs – Keyword arguments
-
calculate_npm_repository_metadata
(repo_key, **kwargs)[source]¶ Recalculate the npm search index for this repository (local/virtual).
Please see the Npm integration documentation for more details. Supported by local and virtual repositories.
Parameters: - repo_key (str) – Key of the repository
- **kwargs – Keyword arguments
-
calculate_nuget_repository_metadata
(repo_key, **kwargs)[source]¶ Recalculate all the NuGet packages for a repository.
(local/cache/virtual), and re-annotate the NuGet properties for each NuGet package according to it’s internal nuspec file. Please see the NuGet integration documentation for more details. Supported by local, local-cache, remote and virtual repositories.
Parameters: - repo_key (str) – Key of the repository
- **kwargs – Keyword arguments
-
calculate_opkg_repository_metadata
(repo_key, x_gpg_passphrase=None, options=None, **kwargs)[source]¶ Calculate/recalculate the Packages and Release metadata fora repository.
Based on the ipk packages in it (in each feed location). Calculation can be synchronous (the default) or asynchronous. Please refer to Opkg Repositories for more details. Supported by local repositories only. By default, the recalculation process also writes several entries from the ipk package’s metadata as properties on all of the artifacts (based on the control file’s content). This operation may not always be required (for example, if the ipk files are intact and were not modified, only the index needs to be recalculated. The operation is resource intensive and can be disabled by passing the ?writeProps=0 query param.
Parameters: - repo_key (str) – Key of the repository
- x_gpg_passphrase (str) – Passphrase
- options (str) – String of options
- **kwargs – Keyword arguments
-
calculate_yum_repository_metadata
(repo_key, x_gpg_passphrase=None, options=None, **kwargs)[source]¶ Calculate/recalculate the YUM metdata for a repository.
Based on the RPM package currently hosted in the repository. Supported by local and virtual repositories only. Calculation can be synchronous (the default) or asynchronous. For Virtual repositories, calculates the merged metadata from all aggregated repositories on the specified path. The path parameter must be passed for virtual calculation.
Parameters: - repo_key (str) – Key of the repository
- x_gpg_passphrase (str) – Passphrase
- options (str) – String of options
- **kwargs – Keyword arguments
-
create_repository
(params, **kwargs)[source]¶ Create a new repository in Artifactory with the provided configuration.
Supported by local, remote and virtual repositories. A position may be specified using the pos parameter. If the map size is shorter than pos the repository is the last one (the default behavior).
Parameters: - params (dict) – Parameters of the repository
- **kwargs – Keyword arguments
-
delete_repository
(repo_key, **kwargs)[source]¶ Remove a repository.
Configuration together with the whole repository content. Supported by local, remote and virtual repositories
Parameters: - repo_key (str) – Key of the repository
- **kwargs – Keyword arguments
-
get_repositories
(options=None, **kwargs)[source]¶ Return a list of minimal repository details.
For all repositories of the specified type.
Parameters: - options (str) – String of options
- **kwargs – Keyword arguments
-
rtpy.rtpy.py¶
Rtpy class definition with it’s attributes which is exposed to the end user.
-
class
rtpy.rtpy.
Rtpy
(settings)[source]¶ Main parent class.
Attributes are the classes are the methods categories.
Parameters: settings (dict) – The user settings, mandaroty keys are “af_url” and “api_key” or “username” and “password”. -
artifacts_and_storage
¶ Category for multiple API methods
Type: rtpy.artifacts_and_storage.RtpyArtifactsAndStorage
-
buils
¶ Category for multiple API methods
Type: rtpy.builds.RtpyBuilds
-
repositories
¶ Category for multiple API methods
Type: rtpy.repositories.RtpyRepositories
-
searches
¶ Category for multiple API methods
Type: rtpy.searches.RtpySearches
-
security
¶ Category for multiple API methods
Type: rtpy.security.RtpySecurity
-
support
¶ Category for multiple API methods
Type: rtpy.support.RtpySupport
-
system_and_configuration
¶ Category for multiple API methods
Type: rtpy.system_and_configuration.RtpySystemAndConfiguration
-
settings
¶ Previously supplied settings at class instantiation
Type: dict
-
rtpy.searches.py¶
Functions for the SEARCHES REST API Methods category.
-
class
rtpy.searches.
RtpySearches
(provided_settings, prefix, category)[source]¶ SEARCHES methods category.
-
artifactory_query_language
(query, **kwargs)[source]¶ Search items using the Artifactory Query Language (AQL).
Parameters: - query (str) – The AQL string
- **kwargs – Keyword arguments
-
list_docker_repositories
(repo_key, options=None, **kwargs)[source]¶ List all Docker repositories (the registry’s _catalog).
(Hosted in an Artifactory Docker repository).
Parameters: - repo_key (str) – Key of the repository
- options (str) – String of options
- **kwargs – Keyword arguments
List all tags of the specified Artifactory Docker repository.
Parameters: - repo_key (str) – Key of the repository
- image_path (str) – Path of the image in the repository
- options (str) – String of options
- **kwargs – Keyword arguments
-
rtpy.support.py¶
rtpy.system_and_configuration.py¶
Functions for the SYSTEM AND CONFIGURATION REST API Methods category.
-
class
rtpy.system_and_configuration.
RtpySystemAndConfiguration
(provided_settings, prefix, category)[source]¶ SYSTEM AND CONFIGURATION methods category.
-
general_configuration
(**kwargs)[source]¶ Get the general configuration (artifactory.config.xml).
Parameters: **kwargs – Keyword arguments
-
get_reverse_proxy_configuration
(**kwargs)[source]¶ Retrieve the reverse proxy configuration.
Parameters: **kwargs – Keyword arguments
-
get_reverse_proxy_snippet
(**kwargs)[source]¶ Get the reverse proxy configuration snippet in text format.
Parameters: **kwargs – Keyword arguments
-
install_license
(params, **kwargs)[source]¶ Install new license key or change the current one.
Parameters: - params (str) – Settings of the license
- **kwargs – Keyword arguments
-
license_information
(**kwargs)[source]¶ Retrieve information about the currently installed license.
Parameters: **kwargs – Keyword arguments
-
save_general_configuration
(xml_file_path, **kwargs)[source]¶ Save the general configuration (artifactory.config.xml).
Parameters: - xml_file_path (str) – Path of the xml file to POST
- **kwargs – Keyword arguments
-
system_health_ping
(**kwargs)[source]¶ Get a simple status response about the state of Artifactory.
Parameters: **kwargs – Keyword arguments
-
rtpy.tools.py¶
Functions and classes used by the main categories of methods.
-
class
rtpy.tools.
RtpyBase
(provided_settings, prefix, category)[source]¶ Rtpy Base class.
-
_prefix
¶ API endpoint used for a given API method category (“search/”…)
Type: str
-
_category
¶ Major API method category (Searches, Repositories…)
Type: str
-
_user_settings
¶ Complete user settings, default values are changed at class instantiation
Type: dict
-
exception
AfApiError
(error_details)[source]¶ Raised when encountering a standard Artifactory REST API error JSON.
-
api_method
¶ Name of the specific method (category and name)
Type: str
-
url
¶ Full URL used for API call
Type: str
-
verb
¶ HTTP verb used for the API call (“GET”, “POST”…)
Type: str
-
status_code
¶ HTTP status code for the API call
Type: int
-
message
¶ Error message given by the Artifactory REST API
Type: str
-
print_message
¶ Well formatted multiline message with all the attributes
Type: str
-
-
rtpy.xray.py¶
Functions for the XRAY REST API Methods category.