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-apiVerified import paths — ran on the pinned version, not inferred.
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.
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.
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.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.
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.
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.
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.