Skip to main content

A python API for making requests to DUPLA (Dataudvekslingsplatformen)

Project description

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://oces.billetautomat.skat.dk/auth/realms/oces/certificates/cert",
    jwt_token_expiration_overlap=5
)

# 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

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

dupla-0.1.0.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

dupla-0.1.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dupla-0.1.0.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for dupla-0.1.0.tar.gz
Algorithm Hash digest
SHA256 57e5a00f5ad0aa7e82df279501578e69819d965a7964dbed5bed6f0713db209c
MD5 60b3173607f0a140b144579b9a5aa720
BLAKE2b-256 0690d756aaa2c641fe134cf562838e9ffe6d91ba0eb426c0d6b4893a709cd50b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dupla-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for dupla-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cc5f2b988b50709ec6501bf2389efe9e04dea853fae59c4aaad70e5a4c3f7efa
MD5 7ccaa26a460fe1fbc4b583ad78e84efb
BLAKE2b-256 9c3fe88245add0e963cea20a0dcc77afcfb123d2be18b7c2e5e4ccc9180a65dd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page