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.0.3.tar.gz (67.7 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for contentgrid_application_client-0.0.3.tar.gz
Algorithm Hash digest
SHA256 a6243c623581fdf2feed13c174a30254dd139328513f8337e8029b74229fcc54
MD5 36f3cc335833f040c0466ae3133e117c
BLAKE2b-256 f102beb2d71439308e745f81156509c7ee15c002b6e0b36afe034613a46b056a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for contentgrid_application_client-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 00cadf79c6a545a7c84910a2c123b2b3d8bd0f9584a5201a3c130b2b676ec01f
MD5 fe5c182d3c627f7f26ebb3cfb6dd6327
BLAKE2b-256 869b44f68a3af39e89caafbe97e6f959af22a854adf01e87b171dfbb7bd86cfa

See more details on using hashes here.

Supported by

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