Registry / devops / cloudsmith-api

cloudsmith-api

JSON →
library2.0.27pypypi✓ verified 90d ago

The `cloudsmith-api` library is an auto-generated Python client for interacting with the Cloudsmith package management API (version 1). It provides programmatic access to manage repositories, packages, users, and more. As of May 2024, the latest version is 2.0.25, with frequent releases reflecting updates to the underlying OpenAPI specification.

pip install cloudsmith-api
INSTALL
IMPORT
SIG · CLOUDSMITH-API
C
cloudsmith-api
devopspythonv2.0.27
Install
2.7s avg
Import
739ms
Disk
37MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2.0.27 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.785s · 37.4MB
glibc
py 3.10–3.920 runs
installs and imports cleanly · install 2.7s · import 0.693s · 38MB
37MB installed
● package 37MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

cloudsmith_api
✓ import cloudsmith_api
The primary module for client configuration and API access.
ApiException
✓ from cloudsmith_api.rest import ApiException
✗ from cloudsmith_api import ApiException
Exception class for handling API errors, located in the 'rest' submodule.
Configuration
✓ import cloudsmith_api
Accessed as `cloudsmith_api.Configuration` for setting up API keys and host.
RepositoriesApi
✓ import cloudsmith_api
Accessed as `cloudsmith_api.RepositoriesApi` for repository-related operations.

This quickstart demonstrates how to authenticate using an API key from an environment variable and list all accessible Cloudsmith repositories. Ensure the `CLOUDSMITH_API_KEY` environment variable is set.

import os import cloudsmith_api from cloudsmith_api.rest import ApiException # Configure API key authorization: X-Api-Key = os.environ.get('CLOUDSMITH_API_KEY', '') if not X_Api_Key: print("Error: CLOUDSMITH_API_KEY environment variable not set.") exit(1) configuration = cloudsmith_api.Configuration(api_key={'X-Api-Key': X_Api_Key}) # Enter a context with an instance of the API client with cloudsmith_api.ApiClient(configuration) as api_client: # Create an instance of the API class repositories_api = cloudsmith_api.RepositoriesApi(api_client) try: # List repositories print("Listing Cloudsmith repositories...") api_response = repositories_api.repos_list() for repo in api_response.data: print(f" - {repo.name} (Slug: {repo.slug}) by {repo.owner}") except ApiException as e: print(f"Exception when calling RepositoriesApi->repos_list: {e}") except Exception as e: print(f"An unexpected error occurred: {e}")
Debug
Known issues
breakingMajor version `2.x.x` of the `cloudsmith-api` client library (released August 2023) introduced potential breaking changes compared to `1.x.x` versions. This was due to an upgrade of the underlying OpenAPI Generator, which can alter method signatures, object structures, and error handling patterns.
fix
Review the official changelog and API documentation for version 2.x.x. Test your application thoroughly after upgrading. Pay attention to changes in model properties and API method parameters.
affects: 1.x.x to 2.x.x
gotchaAPI key authentication requires the key to be passed within a dictionary, mapping 'X-Api-Key' to your actual key. Incorrectly formatted authentication can lead to `401 Unauthorized` errors.
fix
Always configure your API key as `api_key={'X-Api-Key': 'YOUR_API_KEY'}` within the `cloudsmith_api.Configuration` object. Do not pass the key directly as a string or in other header formats.
affects: All versions
gotchaMany API endpoints require both an `owner` slug (your organization or user slug) and a `repo` slug (the repository identifier). Misunderstanding these parameters or providing incorrect slugs often results in `404 Not Found` errors.
fix
Double-check the `owner` and `repo` slugs for accuracy. These are case-sensitive and must exactly match what is configured in Cloudsmith. Consult the Cloudsmith UI or previous API calls to confirm correct slugs.
affects: All versions
Errors
Common errors & fixes
cloudsmith_api.rest.ApiException: (401) Reason: Unauthorized
The provided API key is either missing, invalid, or has insufficient permissions for the requested operation.
fix
Verify that the `CLOUDSMITH_API_KEY` environment variable (or wherever you get your key) is correctly set and contains a valid Cloudsmith API key. Ensure the key has the necessary permissions for the API calls being made.
cloudsmith_api.rest.ApiException: (404) Reason: Not Found
The resource (e.g., repository, package) specified in the API call does not exist, or the owner/repository slugs are incorrect.
fix
Check the `owner`, `repo` (and any other identifier slugs) parameters in your API call. Ensure they are correctly spelled and correspond to existing resources in your Cloudsmith account. Remember slugs are case-sensitive.
AttributeError: module 'cloudsmith_api' has no attribute '...' (e.g., 'RepositoriesApi')
Attempting to access an API client class or function directly from the top-level `cloudsmith_api` module instead of through an instantiated API client.
fix
After importing `cloudsmith_api`, you must first create a `cloudsmith_api.ApiClient` instance (potentially with a `cloudsmith_api.Configuration`). Then, create an API-specific client like `repositories_api = cloudsmith_api.RepositoriesApi(api_client)` before calling methods on it.
Upgrade
Version history
2.0.27latest on PyPI · released Jun 8, 2026
Audit
Dependencies
urllib3requiredHTTP client for API requests.
sixrequiredPython 2 and 3 compatibility utilities.
python-dateutilrequiredDate and time parsing for API responses.
certifirequiredSSL certificates for secure connections.
Agent activity
18 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
cloudsmith-api — pip install cloudsmith-api · libregistry