Skip to main content

pylexoffice

A Python SDK for the Lexoffice API. This library provides a simple and intuitive way to interact with the Lexoffice API.

Installation

pip install pylexoffice

Quick Start

from lexoffice import LexofficeClient

# Initialize the client
client = LexofficeClient(api_key="your_api_key_here")

# Create a contact
contact_data = {
    "version": 0,
    "roles": {
        "customer": {}
    },
    "company": {
        "name": "Sample Company GmbH"
    },
    "addresses": {
        "billing": [{
            "street": "Sample Street 42",
            "zip": "12345",
            "city": "Sample City",
            "countryCode": "DE"
        }]
    }
}

contact = client.contacts.create(contact_data)

# Create an invoice
invoice_data = {
    "voucherDate": "2024-02-22T00:00:00.000+01:00",
    "address": {
        "name": "Sample Company GmbH",
        "street": "Sample Street 42",
        "city": "Sample City",
        "zip": "12345",
        "countryCode": "DE"
    },
    "lineItems": [
        {
            "type": "custom",
            "name": "Product A",
            "quantity": 1,
            "unitName": "Piece",
            "unitPrice": {
                "currency": "EUR",
                "netAmount": 100,
                "taxRatePercentage": 19
            }
        }
    ],
    "totalPrice": {
        "currency": "EUR"
    },
    "taxConditions": {
        "taxType": "net"
    }
}

# Create a draft invoice
invoice = client.invoices.create(invoice_data)

# Create and finalize an invoice
finalized_invoice = client.invoices.create(invoice_data, finalize=True)

Features

  • Full support for Lexoffice API endpoints
  • Rate limiting handling
  • Type hints for better IDE support
  • Intuitive resource-based interface
  • Comprehensive error handling

Available Resources

  • Contacts
  • Invoices
  • Articles
  • Credit Notes
  • Vouchers

Rate Limiting

The Lexoffice API has a rate limit of 2 requests per second. This SDK automatically handles rate limiting by adding appropriate delays between requests.

Error Handling

The SDK provides detailed error handling with custom exceptions:

from lexoffice import LexofficeApiError, RateLimitExceeded

try:
    contact = client.contacts.get("invalid-id")
except RateLimitExceeded:
    print("Rate limit exceeded, please wait")
except LexofficeApiError as e:
    print(f"API error: {e}")

Documentation

For detailed API documentation, please visit the Lexoffice API Documentation.

Requirements

  • Python 3.10+
  • requests>=2.25.0
  • pandas>=2.0.0

License

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

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

If you encounter any problems or have any questions, please open an issue on GitHub.

Metadata

Release files for pylexoffice 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylexoffice 0.1.0
File Size Uploaded
pylexoffice-0.1.0.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pylexoffice 0.1.0
File Interpreter ABI Platform
pylexoffice-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.2 kB

Release files / pylexoffice-0.1.0.tar.gz

Download URL pylexoffice-0.1.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9c00ba95f68f76648867a0c5e8f5106a8692b82e5af30050ed431dfb335667b8
BLAKE2b-256 checksum
How to use checksums
3b81d57bc40f832d842f2bd8a1451c0bee023c795ba99897a645c84b7193d871
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.13

Release files / pylexoffice-0.1.0-py3-none-any.whl

Download URL pylexoffice-0.1.0-py3-none-any.whl
Size 2.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
32b82c8646ffde8b851c3034dc324e8455a8fef86f4650d6bbf73ee0bebec271
BLAKE2b-256 checksum
How to use checksums
a1f418cfa19c764754334cc69bf1ec51f829647d421f1aba024676544a48e060
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.13

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page