Skip to main content

Python SDK for accessing Sage Intacct REST APIs

Project description

Intacct REST SDK for Python

A Python SDK for the Sage Intacct REST API, providing a simple and intuitive interface to interact with Intacct's financial data and operations.

Local Setup

# Create and activate virtual environment
python -m venv venv
source venv/bin/activate

# Install dev dependencies
pip install -r requirements.txt

Quick Start

1. Authentication Setup

First, you'll need to set up OAuth2 credentials with Intacct:

  1. Register your application in Intacct to get client_id and client_secret
  2. Set up environment variables or pass credentials directly
import os
from intacctsdk import IntacctRESTSDK

sdk = IntacctRESTSDK(
    refresh_token='your_refresh_token',
    entity_id='your_entity_id'  # Optional
)

2. Basic Usage

For comprehensive examples and usage patterns, see the example.py file which demonstrates:

  • OAuth2 authentication flow
  • Working with different modules dimensions
  • Filtering and querying data
  • Error handling
  • Token management

Common Methods

All API classes inherit from ApiBase and support these common methods:

get_all_generator(fields, filters=[], filter_expression=None, order_by=[], dimension_name=None)

Returns a generator that yields paginated results.

Parameters:

  • fields (List[str]): List of fields to retrieve
  • filters (List[Dict], optional): Filter conditions
  • filter_expression (str, optional): Filter expression ('and' or 'or')
  • order_by (List[Dict], optional): Sort conditions
  • dimension_name (str, optional): For dimensions API only

get_by_id(id)

Get a single object by its ID.

count(filters=[], filter_expression=None, dimension_name=None)

Get the count of objects matching the filters.

get_model()

Get the schema/model definition for the object type.

Error Handling

The SDK provides custom exceptions for different error scenarios:

from intacctsdk.exceptions import InvalidTokenError, BadRequestError, InternalServerError

try:
    accounts = list(sdk.accounts.get_all_generator(fields=['id', 'name']))
except InvalidTokenError as e:
    print(f"Token error: {e.message}")
    # Handle token refresh or re-authentication
except BadRequestError as e:
    print(f"Bad request: {e.message}")
    # Handle invalid parameters or request format
except InternalServerError as e:
    print(f"Server error: {e.message}")
    # Handle temporary server issues

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

sageintacctrestsdk-1.0.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

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

sageintacctrestsdk-1.0.0-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file sageintacctrestsdk-1.0.0.tar.gz.

File metadata

  • Download URL: sageintacctrestsdk-1.0.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for sageintacctrestsdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 22e5a257c48ee80224fe17d0d7191195f9e8439603275acbd962fd1bec4233bc
MD5 561b9d54b3720e063bf0be7d99e6fbb6
BLAKE2b-256 cef1df58e57bb87dfa479d4496060cd6c04c018f8f30b44e3e3a21644792750f

See more details on using hashes here.

File details

Details for the file sageintacctrestsdk-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sageintacctrestsdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 553d5c8feab8de44af2a55866c1d7e8b12776031253c34d030278fe626d18c00
MD5 0f1b8feea333ac50e5db5f0834f2ec77
BLAKE2b-256 a1ad3d24815d9a897962bd4e0f3c852b89b6d3b9ff13f739317fdc5f4317fd9f

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