Skip to main content

nadag-innmelding-python-client

A client library for accessing Nadag innmelding API

Usage

First, create a client:

from nadag_innmelding_python_client import AuthenticatedClient

secret_token = nadag_authenticate()  # This you need to implement this yourself

client = AuthenticatedClient(
    base_url="https://test.ngu.no/api/",
    token=secret_token,
)

Now call your endpoint and use your models:

from nadag_innmelding_python_client.api.default import get_nadag_innmelding_v_1_geoteknisk_unders as get_geoteknisk_unders
from nadag_innmelding_python_client.models import GeotekniskUnders
from nadag_innmelding_python_client.types import Response

with client as client:
    response: Response[GeotekniskUnders] = get_geoteknisk_unders.sync_detailed(
        client=client,
        ekstern_id=str(project_id),
        ekstern_navnerom="Your Namespace",
    )

    match response.status_code:
        case HTTPStatus.OK:
            geoteknisk_unders: GeotekniskUnders = response.parsed
        case HTTPStatus.NOT_FOUND:
            # Create a new project in NADAG
        case _:
            # Handle other status codes
            raise Exception(f"Got unexpected status code {response.status_code} for project ")

Things to know:

  1. Every path/method combo becomes a Python module with four functions:

    1. sync: Blocking request that returns parsed data (if successful) or None
    2. sync_detailed: Blocking request that always returns a Request, optionally with parsed set if the request was successful.
    3. asyncio: Like sync but async instead of blocking
    4. asyncio_detailed: Like sync_detailed but async instead of blocking
  2. All path/query params, and bodies become method arguments.

  3. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)

  4. Any endpoint which did not have a tag will be in nadag_innmelding_python_client.api.default

Advanced customizations

There are more settings on the generated Client class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying httpx.Client or httpx.AsyncClient (depending on your use-case):

from nadag_innmelding_python_client import Client


def log_request(request):
    print(f"Request event hook: {request.method} {request.url} - Waiting for response")


def log_response(response):
    request = response.request
    print(f"Response event hook: {request.method} {request.url} - Status {response.status_code}")


client = Client(
    base_url="https://api.example.com",
    httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}},
)

# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client()

You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url):

import httpx
from nadag_innmelding_python_client import Client

client = Client(
    base_url="https://api.example.com",
)
# Note that base_url needs to be re-set, as would any shared cookies, headers, etc.
client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030"))

Building / publishing this package

This project uses uv to manage dependencies and packaging. Here are the basics:

  1. Update the metadata in pyproject.toml (e.g. authors, version).
  2. Run uv sync to create the environment and install dependencies.
  3. Build the source and wheel distributions with uv build.
  4. Publish them with uv publish.

If you want to install this client into another project without publishing it (e.g. for development) then:

  1. In a uv project, run uv add <path-to-this-client>.
  2. Otherwise, run uv build --wheel and install the resulting wheel with pip.

Metadata

Release files for nadag-innmelding-python-client 2026.9.17

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

Source distribution (sdist)

Source distribution for nadag-innmelding-python-client 2026.9.17
File Size Uploaded Provenance Actions
nadag_innmelding_python_client-2026.9.17.tar.gz 113.5 kB Without provenance Details for nadag_innmelding_python_client-2026.9.17.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nadag-innmelding-python-client 2026.9.17
File Interpreter ABI Platform Actions
nadag_innmelding_python_client-2026.9.17-py3-none-any.whl Python 3 none any Details for nadag_innmelding_python_client-2026.9.17-py3-none-any.whl

Total release size: 342.9 kB

Release files / nadag_innmelding_python_client-2026.9.17.tar.gz

Download URL nadag_innmelding_python_client-2026.9.17.tar.gz
Size 113.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2dfef4df5e9c5888feb121a38c65a119c7b9703374c0e74fc609a5cd0f3d8c62
BLAKE2b-256 checksum
How to use checksums
f382e975fba23f4d45339943ee27e13ea91b5223096dc4fe60d05d45532b1198
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / nadag_innmelding_python_client-2026.9.17-py3-none-any.whl

Download URL nadag_innmelding_python_client-2026.9.17-py3-none-any.whl
Size 229.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d26bd34b9f66820aeeaf8a007cc36cbda48d8cba5e8a286fc31a9d02660d24fb
BLAKE2b-256 checksum
How to use checksums
b0e9f138ca37b8a7658d1b1e02da25164f7f3018d0a3219249e1fa9b118d1495
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for nadag-innmelding-python-client 2026.9.17

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