pysmartdok
A Python library for the SmartDok API.
Installation
To use in a project, add this to dependencies in pyproject.toml:
"pysmartdok @ git+https://github.com/asterisk-digital/pysmartdok.git@main"
Usage
Uses the SmartDok REST API. Requires an API token.
import pysmartdok
client = pysmartdok.ApiClient(
api_token="your_api_token",
user_agent="myapp(you@example.com)", # optional, defaults to "pysmartdok"
)
# Quality Deviations
qd_reports = client.qd.get_qd_reports(
project_id=123, # optional
qd_status="Open", # optional: Open, Close, Unprocessed, Discarded
)
qd_pdf = client.qd.get_qd_pdf(qd_id=789, include_details=True)
# Projects
projects = client.projects.get_projects(include_inactive=False, include_orders=False)
project = client.projects.get_project(project_id=123)
subprojects = client.projects.get_subprojects(project_id=123)
next_number = client.projects.get_next_project_number()
# RUE summaries (paginates internally, returns all matching reports)
summaries = client.rue.get_rue_summaries(
project_id=123, # optional
rue_status="Open", # optional: Open, Close, Unprocessed, Discarded
last_updated_since="2024-01-01T00:00:00Z", # optional
)
# Single RUE report (full detail)
report = client.rue.get_rue_report(rue_id=456)
# All full RUE reports — fetches summaries then fans out concurrently
reports = client.rue.get_rue_reports(threads=8)
# RUE event log (audit trail)
events = client.rue.get_rue_eventlog(rue_id=456)
# RUE messages/comments
messages = client.rue.get_rue_messages(rue_id=456)
# RUE PDF metadata
pdf_info = client.rue.get_rue_pdf(rue_id=456, include_details=True)
# Users
users = client.users.get_users(include_inactive=False)
me = client.users.get_current_user()
user = client.users.get_user(user_id="...")
license_info = client.users.get_license_info()
Development
Set up the environment with uv:
uv sync
Before pushing, run lint, format, and tests — CI runs the same on Python 3.11, 3.12, 3.13, and 3.14:
uv run ruff check .
uv run ruff format .
uv run tox
Tests use responses to mock the SmartDok API; no token is needed. To smoke-test against the real API, drop a .env at the repo root with SMARTDOK_API_KEY=... and run one of the scripts in scripts/:
uv run python scripts/get_rue_summaries.py
Change conventions
- All changes must conform to the SmartDok OpenAPI spec, which is vendored at
docs/swagger.json. Refresh it from upstream when SmartDok updates the API; commit the diff so spec changes are visible in git history:curl https://api.smartdok.no/docs/v1 -o docs/swagger.json
- New endpoints: add a Pydantic model in
rue_models.py(or a new module) with Norwegian field descriptions matching the SmartDok web UI; add the method to the relevant subclient (Rue,Users, orApiClient); add a mocked test intests/test_basic.py. - Public methods get short docstrings; field descriptions live on the Pydantic model.
- Runtime deps go in
[project.dependencies]with>=bounds; dev deps go in[dependency-groups.dev]with exact pins. - Update
README.mdandCHANGELOG.mdfor any user-visible change.
Metadata
Release files for pysmartdok 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pysmartdok-0.2.0.tar.gz | 52.8 kB | With provenance | Details for pysmartdok-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pysmartdok-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for pysmartdok-0.2.0-py3-none-any.whl |
Total release size: 68.8 kB
Release files / pysmartdok-0.2.0.tar.gz
| Download URL | pysmartdok-0.2.0.tar.gz |
|---|---|
| Size | 52.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4ff76928c4e15dfbbbecf0e0bedcc1281bea4260d4297385fb4bbd837d64cfa
|
|
BLAKE2b-256 checksum How to use checksums |
d61232d129c858471473949f3cbe5b4f979a84d1145ebcbe79228c8ba01d03cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 11, 2026.
Transparency logRelease files / pysmartdok-0.2.0-py3-none-any.whl
| Download URL | pysmartdok-0.2.0-py3-none-any.whl |
|---|---|
| Size | 16.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4fd5ecdfa25520a3a891260d8572b167dc5a4d4362efb4a0aac571041ecc11d5
|
|
BLAKE2b-256 checksum How to use checksums |
5f0ef3fb7f0edf336e98b14789b52b581761d9c0e4d7ec6875e2beca3f9352f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 11, 2026.
Transparency logSecurity for pysmartdok 0.2.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pysmartdok-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 11, 2026.
Transparency logA 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.