Python Client for interacting with ContentGrid Applications
Project description
ContentGrid Application Client
This ContentGrid Client is a Python library designed to interact with ContentGrid API endpoints, specifically in the HAL response type. For ContentGrid Applications, it provides a convenient interface for performing various operations such as fetching profiles, creating entities, fetching related entities, handling content attributes, and more.
Features
- Profile Handling: Fetch profiles to retrieve HAL-forms specification about available entities and their attributes.
- Entity Operations: Create, fetch, update, and delete entities using a simple functions without needing to worry about headers and authentication.
- Content Handling: Upload and download content on content-attributes of entities.
- Error Handling: Provides basic error handling for network requests.
- Attribute validation: Provides attribute type checks for creating and updating entities. Checks wether attributes have the correct type and if all required attributes are present.
Installation
To install the ContentGrid API Client, you can use pip:
pip install contentgrid-application-client
Usage
ContentGridApplicationClient
from contentgrid-application-client import ContentGridApplicationClient
# Initialize the client with service account
client = ContentGridApplicationClient(
client_endpoint="https://b93ccecf-3466-44c0-995e-2620a8c66ac3.eu-west-1.contentgrid.cloud",
auth_uri="https://auth.eu-west-1.contentgrid.cloud/realms/cg-eade54da-3903-4554-aa5e-2982cd4126f1/protocol/openid-connect/token",
client_id="your_client_id",
client_secret="your_client_secret"
)
# Initialize the client with token
client = ContentGridApplicationClient(
client_endpoint="https://b93ccecf-3466-44c0-995e-2620a8c66ac3.eu-west-1.contentgrid.cloud",
token="your_token"
)
# Fetch profile
profile = client.get_profile()
# Create entity
attributes = {
"name": "Example Entity",
"description": "This is an example entity"
}
entity = client.create_entity("entity-name", attributes)
Testing
Installing requirements:
pip install -r requirements.txt
Running tests:
python -m pytest
Running tests with coverage:
coverage run -m pytest && coverage report -m
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file contentgrid_application_client-0.0.5.tar.gz
.
File metadata
- Download URL: contentgrid_application_client-0.0.5.tar.gz
- Upload date:
- Size: 67.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b56f5da499505224bf5cd8afefa3862a62535be74eff9fb1f24e110a8adf7e1 |
|
MD5 | 93e09d002764b54668b4e3da7a59f02c |
|
BLAKE2b-256 | 5dfce910234cb0cda7abe1cfa920a1f329167e3643f00cdbc2d15e645b7e1d9f |
Provenance
The following attestation bundles were made for contentgrid_application_client-0.0.5.tar.gz
:
Publisher:
publish.yml
on xenit-eu/contentgrid-python-client
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
contentgrid_application_client-0.0.5.tar.gz
- Subject digest:
1b56f5da499505224bf5cd8afefa3862a62535be74eff9fb1f24e110a8adf7e1
- Sigstore transparency entry: 146652562
- Sigstore integration time:
- Predicate type:
File details
Details for the file contentgrid_application_client-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: contentgrid_application_client-0.0.5-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ece2aca092b6868ef60d9b9021db583040aceb0e0e8b69de3962cdb52ce19d75 |
|
MD5 | bcf989cca57297ea31fab7247575f12c |
|
BLAKE2b-256 | 180f4b7d7a9ef381893e63bd038dfa85d99a58f0c6605cc51f1b793a458cb57f |
Provenance
The following attestation bundles were made for contentgrid_application_client-0.0.5-py3-none-any.whl
:
Publisher:
publish.yml
on xenit-eu/contentgrid-python-client
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
contentgrid_application_client-0.0.5-py3-none-any.whl
- Subject digest:
ece2aca092b6868ef60d9b9021db583040aceb0e0e8b69de3962cdb52ce19d75
- Sigstore transparency entry: 146652563
- Sigstore integration time:
- Predicate type: