Skip to main content

Python Client for interacting with ContentGrid Management Platform

Project description

ContentGrid Management Client

This ContentGrid Management Client is a Python library designed to interact with the ContentGrid Management API endpoints, specifically in the HAL response type. It provides a convenient interface for performing various operations such as fetching organizations, projects, and blueprints, and managing automations and automation annotations.

Features

  • Organization Handling: Fetch organizations and their associated projects.
  • Project Handling: Fetch projects and their associated blueprints.
  • Blueprint Handling: Manage blueprints including entity definitions and automations.
  • Automation Management: Create and manage automations and their annotations.
  • Error Handling: Provides basic error handling for network requests.

Installation

To install the ContentGrid Management Client, you can use pip:

pip install contentgrid-management-client

Usage

Initialization and Organization Handling

from contentgrid_client import HALFormsClient

# Initialize a HALFormsClient with service account
client = HALFormsClient(
    client_endpoint="https://api.contentgrid.com/",
    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 a HALFormsClient with a token
client = HALFormsClient(
    client_endpoint="https://api.contentgrid.com/",
    auth_uri="https://auth.eu-west-1.contentgrid.cloud/realms/cg-eade54da-3903-4554-aa5e-2982cd4126f1/protocol/openid-connect/token",
    token="your_token"
)

# Get all organizations
organization = get_organizations(hal_client=client)[0]

Project Handling

# Get the first project
project = organization.get_projects()[0]

# Get blueprints of the project
blueprints = project.get_blueprints()

Blueprint Handling

# Get a specific blueprint
blueprint = project.get_blueprint_by_name("blueprint_name")

# Create a new entity definition in the blueprint
entity_definition = blueprint.create_entity("entity_name", "entity_description")

# Get entity definitions
entity_definitions = blueprint.get_entity_definitions()

Automation Management

# Get automations in a blueprint
automations = blueprint.get_automations()

# Create a new automation in the blueprint
automation_data = {
    "foo" : "bar"
}
automation = blueprint.create_automation("automation_name", "system_name", automation_data)

# Create an annotation for an automation
annotation_data = {
    "key": "value"
}
annotation = automation.create_annotation_on_entity("entity_name", annotation_data)

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_management_client-0.1.2.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file contentgrid_management_client-0.1.2.tar.gz.

File metadata

File hashes

Hashes for contentgrid_management_client-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f2439f36587e2516775eaa14f28ee3264633aaf3a82ce1b305be019e46d6e459
MD5 eed7ab677da11acd4024da8ba2fa73a9
BLAKE2b-256 e48039cbd8cbb4e37912ab1e5eddd2a368d042af8113930f76252d8c9be5d90e

See more details on using hashes here.

Provenance

The following attestation bundles were made for contentgrid_management_client-0.1.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_management_client-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for contentgrid_management_client-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7507d3ec3ee02f0d98fd6de0e8582ca96652e3427addd3e06ea7cc8a7b498d26
MD5 292fba847b74f0bb839d7b0c69eb9723
BLAKE2b-256 d25804e15b35bda4fd6bb52ba9a4bb5cef3f3f039a2291241e90d7b8e2362090

See more details on using hashes here.

Provenance

The following attestation bundles were made for contentgrid_management_client-0.1.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