Python SDK for the Lexoffice API
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pylexoffice-0.1.0.tar.gz.
File metadata
- Download URL: pylexoffice-0.1.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c00ba95f68f76648867a0c5e8f5106a8692b82e5af30050ed431dfb335667b8
|
|
| MD5 |
f0e5a364d51c31ac2595be9eaa7c0625
|
|
| BLAKE2b-256 |
3b81d57bc40f832d842f2bd8a1451c0bee023c795ba99897a645c84b7193d871
|
File details
Details for the file pylexoffice-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pylexoffice-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32b82c8646ffde8b851c3034dc324e8455a8fef86f4650d6bbf73ee0bebec271
|
|
| MD5 |
d86945faf1c182f9889dc1154cc4bca4
|
|
| BLAKE2b-256 |
a1f418cfa19c764754334cc69bf1ec51f829647d421f1aba024676544a48e060
|