3scale-api-python-crd
3scale client uses CRs for object definition. CRs are processed by 3scale Operator.
Installing
Install and update using pip:
pip install 3scale-api-crd
Or as a dependency using the pipenv
pipenv install 3scale-api-crd
Usage
Client supports basic CRUD operations and it generates CRs in Openshift namespace defined by oc session.
Basic usage of the client:
oc login
oc project example
import threescale_api_crd
client = threescale_api_crd.ThreeScaleClientCRD(url="myaccount.3scale.net", token="secret_token", ssl_verify=True, ocp_provider_ref="secret_with_credentials")
Using of objects are described in 3scale API client README.
Run the Smoke Tests
To run the tests you need to have installed development dependencies:
pipenv install --dev
and then run the pytest:
pipenv run pytest -m smoke
Integration tests configuration
To run the integration tests you need to set these extra env variables:
THREESCALE_PROVIDER_URL='https://example-admin.3scale.net'
THREESCALE_PROVIDER_TOKEN='<test-token>'
THREESCALE_MASTER_URL='https://master.3scale.net'
THREESCALE_MASTER_TOKEN='<test-master-token>'
and to have valid oc tool session to Openshift where 3scale Operator is deployed and watches for CRs.
By default:
- oc namespace should be the namespace where 3scale instance is deployed
- the system-seed secret is used by 3scale Operator client
- THREESCALE_ variables are used for not implemented Threescale client features
If CRs are created in different namespace to 3scale deployment, env variable
OCP_PROVIDER_ACCOUNT_REF can be specified with secret name used by 3scale Operator client,
see https://github.com/3scale/3scale-operator/blob/master/doc/backend-reference.md#provider-account-reference
Finished integration unit tests
- AccountUsers
- Accounts
- ActiveDocs
- ApplicationPlans
- BackendMappingRules
- BackendMetrics
- BackendUsages
- Backends
- Limits
- MappingRules
- Metrics
- OpenApis
- Policies
- PolicyRegistries
- PricingRules
- Proxies
- Services
- Tenants
- ProxyConfigPromote
- Applications
- Methods
- ApplicationAuth
Command to run integration unit tests: pipenv run pytest --log-cli-level=10 -vvvv -s ./tests/integration/ |& tee x
TODO
- do https://github.com/3scale/3scale-operator/pull/813
- do not simulate app plan id
- create unit integration tests for:
- ProductDeploymentSpec
- AuthenticationSpec
- implement delete of policies + add unit tests
- add proper error messages in case of for example missing required arguments, see test_should_fields_be_required
- implement optimitazation on the oc level:
- for every test run, label objects - oc label product.capabilities.3scale.net/testyrclkfzyhue test_run=new --overwrite
- use only objects labeled by test run id - oc get product.capabilities.3scale.net --show-labels=true -l test_run=new
Metadata
Release files for 3scale-api-crd 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| 3scale-api-crd-0.1.6.tar.gz | 42.0 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 3scale_api_crd-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 95.1 kB
Release files / 3scale-api-crd-0.1.6.tar.gz
| Download URL | 3scale-api-crd-0.1.6.tar.gz |
|---|---|
| Size | 42.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b6b3a608b232488584515a39447b7cd139f8309aaf451f0ed0548eee8c42575a
|
|
BLAKE2b-256 checksum How to use checksums |
d094b0f532d7e63ec8da2fecec0a5f0ae9f82df3d3b218550bee5f928c6ea65a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 23, 2025.
Transparency logRelease files / 3scale_api_crd-0.1.6-py3-none-any.whl
| Download URL | 3scale_api_crd-0.1.6-py3-none-any.whl |
|---|---|
| Size | 53.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8fa1cb7736020e46c9c02878957d553949aa9a3170592bde812f68bfc2258742
|
|
BLAKE2b-256 checksum How to use checksums |
da1dbc649fc464163b58844bc4af1b5352f61ad5f47c9d18526ea359099db64e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 23, 2025.
Transparency logSecurity for 3scale-api-crd 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for 3scale-api-crd-0.1.6.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 23, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.