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.KtrPayloaddupla.payload.LigPayloaddupla.payload.MomsPayloaddupla.payload.KtrObsPayloaddupla.payload.LonsumPayloaddupla.payload.SelskabSambeskatningPayloaddupla.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
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 dupla-0.1.2.tar.gz.
File metadata
- Download URL: dupla-0.1.2.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db80262c4f55607563683b6f0260ddd7f628a0c60255163bc997f1d0b4fa2253
|
|
| MD5 |
7baf88a13add230861962d295fc5f7dc
|
|
| BLAKE2b-256 |
16623fdbaf5c432ec2c44dbc05952d8f4ff7931971abf3fe154da4de0725089a
|
File details
Details for the file dupla-0.1.2-py3-none-any.whl.
File metadata
- Download URL: dupla-0.1.2-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87107246c89e717b5a98fc4b77baf075a99df022fd185a915f207d6a047e2b2f
|
|
| MD5 |
bf8f6033f3914629adc4402d129b95a5
|
|
| BLAKE2b-256 |
cd2d9f570d6b48637945b499717f79afc78ded50b55738ea927329a583bca5d6
|