Skip to main content

DATEV API Integration with FastAPI backend and Streamlit frontend

Project description

PyDATEV

A Python library and FastAPI/Streamlit application that provides a unified interface for interacting with DATEV's various API services. This library integrates multiple DATEV APIs including accounting, HR, payroll, and cash register services.

Features

  • Authentication: OAuth2 integration with DATEV's authentication system
  • Client Management: View and manage DATEV clients
  • Document Management: Upload and manage documents
  • HR Services:
    • eAU (electronic Certificate of Incapacity for Work) management
    • Employee data access
    • Payroll reporting
  • Cash Register Integration: Manage cash register data and tenants
  • Master Data Management: Search and manage master client data
  • Interactive Dashboard: User-friendly Streamlit interface for all services

Prerequisites

  • Python 3.8+
  • DATEV API credentials (Client ID and Client Secret)
  • Valid DATEV account with appropriate permissions

Installation

  1. Clone the repository:
git clone https://github.com/superpandas-ai/pydatev.git
cd pydatev
  1. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install the package in development mode:
pip install -e .
  1. Create a .env file in the root directory with your DATEV credentials:
DATEV_CLIENT_ID=your_client_id
DATEV_CLIENT_SECRET=your_client_secret
DATEV_REDIRECT_URI=http://localhost:8501/callback
  1. Create a .streamlit/secrets.toml file with your OAuth credentials:
[oauth]
client_id = "your_client_id"
client_secret = "your_client_secret"

Project Structure

pydatev/
├── src/
│   └── pydatev/
│       ├── app/
│       │   ├── models/
│       │   │   └── __init__.py
│       │   └── __init__.py
│       └── __init__.py
├── tests/
│   └── conftest.py
├── setup.py
├── pytest.ini
├── .env
└── README.md

Running the Application

  1. Start the FastAPI backend:
uvicorn pydatev.app.main:app --reload
  1. In a separate terminal, start the Streamlit frontend:
streamlit run pydatev/app/frontend.py
  1. Access the application:

Using the Library

from pydatev import DATEVClient

# Initialize the client
client = DATEVClient(client_id="your_client_id", client_secret="your_client_secret")

# Use the client to interact with DATEV APIs
clients = client.get_clients()

API Structure

The application provides endpoints for various DATEV services:

  • /clients/* - Client management endpoints
  • /documents/* - Document management
  • /hr/* - HR-related services
  • /tenants/* - Cash register management
  • /master-clients/* - Master data management
  • /payrollreports/* - Payroll reporting

For detailed API documentation, visit the Swagger UI at /docs when running the application.

Testing

Run the tests using pytest:

pytest

Authentication

The library and application use OAuth2 for authentication with DATEV's services. Users need to:

  1. Log in through the Streamlit interface or initialize the client with credentials
  2. Authorize the application
  3. Handle the OAuth callback
  4. Use the received token for API requests

Error Handling

The library includes comprehensive error handling for:

  • Authentication failures
  • API request errors
  • Invalid data submissions
  • Token expiration

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

[Add your license information here]

Support

For support, please create an issue in the repository.

Acknowledgments

  • DATEV for providing the API services
  • FastAPI and Streamlit communities

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

pydatev-0.1.0.tar.gz (143.6 kB view details)

Uploaded Source

Built Distribution

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

pydatev-0.1.0-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file pydatev-0.1.0.tar.gz.

File metadata

  • Download URL: pydatev-0.1.0.tar.gz
  • Upload date:
  • Size: 143.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for pydatev-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9f723a92ee3c7ad3127b621874b91e430a9a5bb32755b469351cb75b4ba44e2e
MD5 a630f840e0ecc18659f3d6589762a221
BLAKE2b-256 ed2c01fd86b7d8a003b621182c20e49b287785a83ec298fe588d109762ef7742

See more details on using hashes here.

File details

Details for the file pydatev-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pydatev-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for pydatev-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 627c589cb70dd999c870789b1eeece4cdcc50c1b8b83e71989b8717b68edba05
MD5 f00a2fe8c44945c01a60f17f67a26f20
BLAKE2b-256 95bafabd2c382deab12d70e2857553a855d8d79ac49bd64f0a4eebf38c232722

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