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://bat.skat.dk/realms/oces/protocol/openid-connect/token",
    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.2.1.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

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

dupla-0.2.1-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dupla-0.2.1.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for dupla-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b4c93dc1980b90af3a89f4466b9092de16b0087e3f3b58b8eab9043d87e7a56b
MD5 3718ea772dc66257765f129acab768f5
BLAKE2b-256 9e3c7271372d22eb4209fce45fc1efd943cb9380b79f01b260fe30121bd672a0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dupla-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for dupla-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d0da2ff109a38a653461b26653c395388c28240f3cdfa841e16d1cc00f7aa303
MD5 71546a0d111a292867c5a0cc0e179e35
BLAKE2b-256 e09b2bdda0888a387c6752384787d28d5f8dbb939029fc3b1a073811a613f170

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