Python library to connect with Alanube API
Project description
Alanube Python API
A lightweight Python client for connecting to the Alanube e-invoicing API across multiple countries.
📚 Table of Contents
Instalation
To install the Alanube library, you can use pip:
pip install alanube
Usage
# Import the Alanube class specific to the country,
# in this case from `alanube.do` for the Dominican Republic
from alanube.do import Alanube
# Connect to the API
Alanube.connect("[TOKEN]")
payload = {...}
data = Alanube.send_document(encf_type=31, payload)
Now you can easily and efficiently use the Alanube API with this Python library!
Dominican Republic API Methods
| Method | Description |
|---|---|
create_company |
Create a new company. |
update_company |
Update company information. |
get_company |
Retrieve company info. |
send_fiscal_invoice |
Issue Fiscal Credit Invoice (31). |
get_fiscal_invoice |
Get status of a Fiscal Credit Invoice. |
get_fiscal_invoices |
List Fiscal Credit Invoices. |
send_invoice |
Issue Consumption Invoice (32). |
get_invoice |
Get status of a Consumption Invoice. |
get_invoices |
List Consumption Invoices. |
send_debit_note |
Issue Debit Note (33). |
get_debit_note |
Get status of a Debit Note. |
get_debit_notes |
List Debit Notes. |
send_credit_note |
Issue Credit Note (34). |
get_credit_note |
Get status of a Credit Note. |
get_credit_notes |
List Credit Notes. |
send_purchase |
Issue Purchase Document (41). |
get_purchase |
Get status of a Purchase Document. |
get_purchases |
List Purchase Documents. |
send_minor_expense |
Issue Minor Expense Document (43). |
get_minor_expense |
Get status of a Minor Expense Document. |
get_minor_expenses |
List Minor Expense Documents. |
send_special_regime |
Issue Special Regime Document (44). |
get_special_regime |
Get status of a Special Regime Document. |
get_special_regimes |
List Special Regime Documents. |
send_gubernamental |
Issue Government Document (45). |
get_gubernamental |
Get status of a Government Document. |
get_gubernamentals |
List Government Documents. |
send_export_support |
Issue Export Support Document (46). |
get_export_support |
Get status of an Export Support Document. |
get_export_supports |
List Export Support Documents. |
send_payment_abroad_support |
Issue Payment Abroad Support Document (47). |
get_payment_abroad_support |
Get status of a Payment Abroad Support Document. |
get_payment_abroad_supports |
List Payment Abroad Support Documents. |
send_cancellation |
Issue a cancellation document. |
get_cancellation |
Get status of a cancellation. |
get_cancellations |
List cancellations. |
get_received_document |
Retrieve a received document. |
get_received_documents |
List received documents. |
check_directory |
Check active companies in directory. |
check_dgii_status |
Check DGII service status and maintenance. |
get_report_companies_documents_total |
Get total documents issued by a company. |
get_report_users_documents_total |
Get total documents issued by the authenticated user. |
get_report_company_emitted_documents |
Get total documents emitted by a company. |
get_report_company_emitted_documents_monthly |
Monthly totals of emitted documents (12 months). |
get_report_company_emitted_documents_15_days |
Daily totals of emitted documents (last 15 days). |
get_report_company_accepted_documents |
Total documents accepted by DGII for a company. |
get_report_company_accepted_documents_monthly |
Monthly totals of accepted documents (12 months). |
get_report_company_accepted_documents_15_days |
Daily totals of accepted documents (last 15 days). |
Contents
do: Fully implemented for the Dominican Republic (DGII).pa,cr,pe,bo: Planned support. Follow the structure of thedomodule.
For the missing countries, you can use the do directory as a reference to build the required implementations, adapting the logic to meet the specific local requirements of each country.
Links
Roadmap
- 🇩🇴 Dominican Republic
- 🇵🇦 Panama
- 🇨🇷 Costa Rica
- 🇵🇪 Peru
- 🇧🇴 Bolivia
Used by
This library is trusted and used in production by:
|
Unolet ERP and electronic invoicing platform for SMEs. |
If your company uses this library and would like to be listed here, feel free to open a pull request or create an issue.
Developers
If you're contributing to the development of this library, here are the steps to set up your environment and run the tests:
Setting Up the Environment
-
Clone the repository:
git clone https://github.com/wilmerm/alanube-python.git cd alanube-python
-
Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the required dependencies:
pip install -r requirements.txt pip install -r requirements-dev.txt
-
Install the library in editable mode:
pip install -e .
-
Code Style. We follow PEP 8 for coding standards. Please ensure your code is formatted accordingly before submitting a pull request.
flake8 alanube
Running the Tests
-
Navigate to the project root directory.
-
Execute the tests with unittest:
python -m unittest discover -s alanube/tests -p "*.py"
- -s: Specifies the directory to look for tests (tests folder).
- -p: Defines the pattern for test file names (e.g., *.py).
Building and Publishing the Library
To compile and upload the library to PyPI, follow these steps:
-
Ensure you have the necessary dependencies:
pip install build twine
-
Build the package:
python -m build
-
(Optional) Verify the package:
twine check dist/*
-
Upload the package to PyPI:
python -m twine upload dist/*
Credits
|
Wilmer Martinez Author & Maintainer |
Oriku Precious Documentation Contributor |
If you contributed to this project and would like to be listed here, feel free to open a pull request adding yourself to the credits section.
Licence
This project is licensed under the MIT License.
Proyect Status
✅ This project is in production and actively maintained.
Contributing
We welcome pull requests and suggestions. Please open an issue or submit a PR.
Support 💗
If you find this useful, consider supporting.
Your generosity helps us to continue improving and maintaining this project. We appreciate every contribution, however small. Thanks for being part of our community!
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 alanube-1.2.0.tar.gz.
File metadata
- Download URL: alanube-1.2.0.tar.gz
- Upload date:
- Size: 22.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
691a93f9fd256b033d3fa695940b49afce87d0b087db0a25ab94408f3bac2a11
|
|
| MD5 |
d392a1a06b846f7c4abd18811c0901c4
|
|
| BLAKE2b-256 |
4a018eb423d282c829560be55a7035111262152e8b203ab3d117a1bb763855ff
|
File details
Details for the file alanube-1.2.0-py3-none-any.whl.
File metadata
- Download URL: alanube-1.2.0-py3-none-any.whl
- Upload date:
- Size: 21.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa7f93a58cedb524c8dbd8973b446ef328613b8c5f20ca6c2893294b91b6ec81
|
|
| MD5 |
69bbd07129c5908a09592a07a82d8bd9
|
|
| BLAKE2b-256 |
956d2467178510a4ba3f40a2cb44357665855676a3dba02742f581a3dfa6b8b1
|