Skip to main content

Client library for the ExcelJet API

Project description

ExcelJet API Client

A Python client for the ExcelJet API. This client library provides convenient access to the ExcelJet API from Python applications.

Installation

# Install the package
pip install exceljet-client

# For developers: Install with development dependencies
pip install "exceljet-client[dev]"

# For local development from source
git clone https://github.com/exceljet2/exceljet-client.git
cd exceljet-client
pip install -e ".[dev]"

Usage

from exceljet_client import ExceljetClient
from exceljet_client.models import ContentType

# Initialize the client
client = ExceljetClient(api_key="your_api_key")

# List nodes with optional filtering
nodes = client.list_nodes(content_type=ContentType.FUNCTION, limit=10)
print(f"Found {nodes.count} nodes")

# Get a specific node
node = client.get_node(node_id=123)
print(f"Node title: {node.title}")

# Get node as markdown
markdown = client.get_node_markdown(node_id=123)
print(markdown)

# Create a new node
from exceljet_client.models import BackdropNode

new_node = BackdropNode(
    nid=456,
    title="New Function Example",
    type="function",
    path="functions/new-example",
    created=int(time.time()),
    changed=int(time.time()),
    status=True,
    body="Example function body"
)

created_node = client.create_node(new_node)
print(f"Created node: {created_node.nid}")

# Update an existing node
updated_node = client.update_node(node_id=456, node=new_node)

# Delete a node
client.delete_node(node_id=456)

Bulk Operations

The client supports bulk operations for creating, updating, and deleting multiple nodes:

# Bulk create nodes
nodes_to_create = [node1, node2, node3]
result = client.create_nodes_bulk(nodes_to_create)
print(f"Created {result.created} nodes")

# Bulk update nodes
result = client.update_nodes_bulk(nodes_to_update)
print(f"Updated {result.updated} nodes")

# Bulk delete nodes
result = client.delete_nodes_bulk([123, 456, 789])
print(f"Deleted {result.deleted} nodes")

Error Handling

The client raises typed exceptions for different error cases:

from exceljet_client.exceptions import ExceljetApiError, NodeNotFoundError

try:
    node = client.get_node(node_id=999999)
except NodeNotFoundError:
    print("Node not found")
except ExceljetApiError as e:
    print(f"API error: {e.status_code} - {e.detail}")

API Reference

See the full API reference for detailed documentation.

License

MIT

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

exceljet_client-0.1.4.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

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

exceljet_client-0.1.4-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file exceljet_client-0.1.4.tar.gz.

File metadata

  • Download URL: exceljet_client-0.1.4.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.8

File hashes

Hashes for exceljet_client-0.1.4.tar.gz
Algorithm Hash digest
SHA256 a9cd4b221cd75658e9b2c630cda395877be08ac93dac7bf3911bfd96235ba887
MD5 80c6689081e16b11f28ebe427cd4d3d3
BLAKE2b-256 aa5c84dd6f94e677a4f3f29f994f1416f2b01255fc2a2d1e44a55f4cd8d14317

See more details on using hashes here.

File details

Details for the file exceljet_client-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for exceljet_client-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ec0b030519d1089de12d5b55ed77ad09900c827ed7325a242717446230ccc17e
MD5 bd72f7bc46ab8a5feab82158e6ebac8b
BLAKE2b-256 011d6104b2331e6137c209b156c8e625c4f84a106102a7504eddccf99d33c757

See more details on using hashes here.

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