Python

Python SDK

v2.1.0

Official Python SDK for server-side applications and data science workflows

Installation

pip install taxu

Quick Start

Initialize the Client

import taxu
import os

client = taxu.Client(
    api_key=os.environ.get('TAXU_API_KEY')
)

Upload a Document

with open('w2.pdf', 'rb') as file:
    uploaded = client.documents.upload(
        file=file,
        type='w2',
        year=2024
    )

print(f'Document ID: {uploaded.id}')

Calculate Tax Refund

# Calculate and print tax refund
print(client.tax.calculate_refund(
    filing_status='single',
    income=75000,
    deductions={'standard': True},
    year=2024
).amount)

Features

Type Hints

Full type annotations for IDE support

Async Support

Built-in asyncio compatibility

Pandas Integration

Export data to DataFrames

Context Managers

Pythonic resource management

API Reference

client.documents.upload(**kwargs)

Upload a tax document for processing

Parameters:

  • file - File object or path
  • type - Document type (w2, 1099, etc.)
  • year - Tax year

client.tax.calculate_refund(**kwargs)

Calculate estimated tax refund

Parameters:

  • filing_status - Filing status
  • income - Total income
  • deductions - Deduction details
  • year - Tax year

client.webhooks.verify(payload, signature, secret)

Verify webhook signature

Parameters:

  • payload - Webhook payload bytes
  • signature - X-Taxu-Signature header
  • secret - Webhook secret