Skip to main content

Python client SDK for the Realforce API

Project description

Realforce API - Python SDK

Python client SDK for the Realforce API.

Version: 0.0.26

Installation

pip install realforce-api-client

Authentication

Use a Realforce Personal Access Token (PAT). Generate one in the Realforce dashboard. Send it as a Bearer token in the Authorization header.

from realforce_api_client import AuthenticatedClient

client = AuthenticatedClient(
    base_url="https://api.realforce.com",
    token="rfp_xxxxxxxxxxxxxxxx",
)

Workspace ID

Most endpoints are scoped to a workspace. The generated client surfaces this as an x_workspace_id parameter (string GUID) on each method — pass the workspace your token has access to on every call:

workspace_id = "00000000-0000-0000-0000-000000000000"
agent = get_agent.sync(client=client, agent_id=agent_id, x_workspace_id=workspace_id)

Quick Start

from realforce_api_client import AuthenticatedClient
from realforce_api_client.api.agents import query_agents

client = AuthenticatedClient(
    base_url="https://api.realforce.com",
    token="rfp_xxxxxxxxxxxxxxxx",
)

workspace_id = "..."
agents = query_agents.sync(client=client, x_workspace_id=workspace_id)

Async Usage

Every endpoint exposes both .sync() and .asyncio() variants:

import asyncio
from realforce_api_client import AuthenticatedClient
from realforce_api_client.api.agents import get_agent

client = AuthenticatedClient(
    base_url="https://api.realforce.com",
    token="rfp_xxxxxxxxxxxxxxxx",
)

async def main():
    agent = await get_agent.asyncio(client=client, agent_id=agent_id, x_workspace_id=workspace_id)

asyncio.run(main())

Error Handling

By default the client raises httpx.HTTPStatusError for non-2xx responses. Use the _detailed endpoint variants when you need to inspect the status code and parsed body without raising:

from realforce_api_client.api.agents import get_agent

response = get_agent.sync_detailed(client=client, agent_id=agent_id, x_workspace_id=workspace_id)
if response.status_code == 200:
    agent = response.parsed
else:
    print(f"HTTP {response.status_code}: {response.content!r}")

Custom httpx Client

AuthenticatedClient wraps an httpx.Client. Pass httpx_args to configure timeouts, retries, proxies, etc.:

from realforce_api_client import AuthenticatedClient

client = AuthenticatedClient(
    base_url="https://api.realforce.com",
    token="rfp_xxxxxxxxxxxxxxxx",
    httpx_args={"timeout": 30.0},
)

Requirements

  • Python 3.9+
  • httpx >=0.23.0, <0.29.0

Support

  • Please contact the Realforce support team.

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

realforce_api_client-0.0.26.tar.gz (150.2 kB view details)

Uploaded Source

Built Distribution

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

realforce_api_client-0.0.26-py3-none-any.whl (298.6 kB view details)

Uploaded Python 3

File details

Details for the file realforce_api_client-0.0.26.tar.gz.

File metadata

  • Download URL: realforce_api_client-0.0.26.tar.gz
  • Upload date:
  • Size: 150.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for realforce_api_client-0.0.26.tar.gz
Algorithm Hash digest
SHA256 10fbbd8c11299b2af2c17ccb1134a488c79410e012e7b7e0fa542e412e4ba154
MD5 759f5785b0fc64dd50ea7f1e976ecb06
BLAKE2b-256 de539af416d71c41013fefdc8b760c2432ab214fe6727cdac190c0147db28126

See more details on using hashes here.

File details

Details for the file realforce_api_client-0.0.26-py3-none-any.whl.

File metadata

File hashes

Hashes for realforce_api_client-0.0.26-py3-none-any.whl
Algorithm Hash digest
SHA256 3d6a725e3f92774139a5976c794fc275c6e7df4155639d85f22501a02c81e436
MD5 97d8b1316a35246000c99e8703110344
BLAKE2b-256 cb5bcf066c0b56365ee5d787a193d41463c394ea19a3895608803f5fe8fd840d

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