Skip to main content

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

contentgrid_application_client-0.2.2.tar.gz (77.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

contentgrid_application_client-0.2.2-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file contentgrid_application_client-0.2.2.tar.gz.

File metadata

File hashes

Hashes for contentgrid_application_client-0.2.2.tar.gz
Algorithm Hash digest
SHA256 b61b660b3ea27e0d4a067ebda40caeffb16049b58235cae78da1cc8f545374b8
MD5 259eee4bba008619490839c0f836cc9e
BLAKE2b-256 e2f5e6e1f044c98e09574f7fb39c0c7f82f05b56de51d507b024e113b6b7d246

See more details on using hashes here.

Provenance

The following attestation bundles were made for contentgrid_application_client-0.2.2.tar.gz:

Publisher: publish.yml on xenit-eu/contentgrid-python-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file contentgrid_application_client-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for contentgrid_application_client-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 89795a8b502fdeacf4dc1d4a8986c280d25ddc06ff144334db3c1353bb66b696
MD5 d2a24a837da2ff1ec7653fa1be3a7fb5
BLAKE2b-256 2919b5f7d5e89c587dd3b086c01b1dd0b1a757b3d2c01ea2950c3bf4debace41

See more details on using hashes here.

Provenance

The following attestation bundles were made for contentgrid_application_client-0.2.2-py3-none-any.whl:

Publisher: publish.yml on xenit-eu/contentgrid-python-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page