Installation

Installation

Installation

Install

pip install nomad_media_pip

Construct an authenticated client

Nomad_SDK(config) auto-logs in on first use when username + password are present (real username/password login — no token minting). Keep credentials in gitignored config.

from nomad_media_pip.src.nomad_sdk import Nomad_SDK

config = {
    "serviceApiUrl": "https://nomad-admin-api.yourdomain.com/api",
    "apiType": "admin",          # "admin" | "portal"
    "username": "<from-config>", # never hard-code
    "password": "<from-config>", # never hard-code
    "disableLogging": True,      # the SDK logs the username unless disabled
}

sdk = Nomad_SDK(config)
asset = sdk.get_asset("<asset-id>")  # login happens here on the first call

Notes / gotchas

  • apiType must be "admin" for the asset/folder ops in this catalog; they raise InvalidAPITypeException on a portal client.
  • The SDK logs datetime lines (one echoes the username). Set "disableLogging": True.
  • Method names are snake_case (create_folder_asset, get_asset). See ../reference/naming-map.md for the Python ↔ JS map.
  • Auth fields stored on the instance: token, refreshToken, expirationSeconds, id. Refresh with sdk.refresh_token.
  • See Authentication for the login/secret-hygiene rules.