Skip to main content

Project description

A Python API for DUPLA (Dataudvekslingsplatformen)

A list of the services available can be found here

Setup

For development python -m venv .venv

source .venv/bin/activate

pip install ".[test]"

Run tests: pytest tests/

Getting Started

Using pre-defined API endpoints

This package defines some endpoints which has some (limited) knowledge of the API schema used by SKAT. The classes are:

  • dupla.payload.KtrPayload
  • dupla.payload.LigPayload
  • dupla.payload.MomsPayload
  • dupla.payload.KtrObsPayload
  • dupla.payload.LonsumPayload
  • dupla.payload.SelskabSambeskatningPayload
  • dupla.payload.SelskabSelvangivelsePayload

Please c.f. the docs of the respective classes for more information on what each endpoint is for. Each payload model is a Pydantic model, so inputs are validated.

Using the base API

The base api access class can be used as following. In this example, we access the VAT (Moms in Danish) endpoint.

from datetime import date, timedelta
from uuid import uuid4
import dupla
from dupla import DuplaApiKeys

api = dupla.DuplaAccess(
    transaction_id=str(uuid4()),
    agreement_id="your-aftale-id-goes-here",
    pkcs12_filename="path-to-cert-file",
    pkcs12_password="goodpassword",
    billetautomat_url="https://bat.skat.dk/realms/oces/protocol/openid-connect/token",
    jwt_token_expiration_overlap=5,
    timeout=30.0  # Optional, default: 30.0
)

# lets see if this company (se_number 98765432) has done any VAT the last year
kwargs = {DuplaApiKeys.SE: ["98765432"],
          DuplaApiKeys.AFREGNING_START: date.today() - timedelta(days=365),
          DuplaApiKeys.AFREGNING_SLUT: date.today()}
payload = dupla.payload.MomsPayload(**kwargs)

data = api.get_data(payload)

print(data)

© ERST 2023

Metadata

Release files for dupla 0.2.2

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

Source distribution (sdist)

Source distribution for dupla 0.2.2
File Size Uploaded Provenance Actions
dupla-0.2.2.tar.gz 19.8 kB Without provenance Details for dupla-0.2.2.tar.gz

Built distribution (wheel)

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

Total release size: 37.2 kB

Release files / dupla-0.2.2.tar.gz

Download URL dupla-0.2.2.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
11dbba181be2840ce5134718d461e2b58b860f8339791ce779406cfafc906593
BLAKE2b-256 checksum
How to use checksums
abbb8f1f8e0034c333ff48ff6db16c6ecf4e2c24dd422848a8e63fa4f57dda47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.13

Release files / dupla-0.2.2-py3-none-any.whl

Download URL dupla-0.2.2-py3-none-any.whl
Size 17.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
597fab98b94df1f9327ee134ceaf8c72b86fbad4113cee9537e69c661271cf20
BLAKE2b-256 checksum
How to use checksums
f76176d443ed384bd342ad986d8eeb3199cdeae635e70b8d548450fb713c2edb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.13

Security for dupla 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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