Skip to main content

nl-export

nl-export ist ein Kommandozeilen-Tool, um Daten aus einem NL-CMS (Plone) via REST-API zu exportieren.

Entwickelt von der Verbundzentrale des GBV (VZG) für die Nutzung im Kontext der Nationallizenzen.

Funktionen

  • konfig — Konfiguration mit API-Zugangsdaten erstellen und anzeigen
  • lzn — Lizenznehmer zu einem oder mehreren Lizenzmodellen/Produkten exportieren
    • Ausgabeformate: CSV, XML, JSON (v1/v2/v3 Schema)
  • proxy — Einzelnutzer-Lizenzmodelle für den Proxy-Betrieb exportieren (CSV)

Voraussetzungen

  • Python ≥ 3.12
  • Zugriff auf ein NL-CMS mit gültigem Access-Token

Installation

Das Paket ist auf PyPI verfügbar.

Endnutzer

# Mit uv (empfohlen)
uv tool install nl.export

# Mit pip (in einer isolierten Umgebung)
mkdir nl-export && cd nl-export
python3 -m venv .venv
source .venv/bin/activate
pip install nl.export

Entwicklung (lokales Repository)

# Repository klonen
git clone https://github.com/gbv/nl.export.git
cd nl.export

# Mit uv
uv tool install .
uv pip install -e ".[dev]"

# Mit pip (in einer isolierten Umgebung)
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

Konfiguration

Vor der ersten Nutzung muss eine Konfigurationsdatei angelegt werden:

nl-export konfig

Das Tool fragt nach Access-Token und CMS-URL und legt die Konfiguration unter folgendem Pfad an:

$XDG_CONFIG_HOME/nl_export.conf

Falls $XDG_CONFIG_HOME nicht gesetzt ist, wird ~/.config/nl_export.conf verwendet.

Die Datei hat folgendes Format:

[plone]
access-token = IhrTokenHier
base-url = https://cms.example.com

Mit --show wird die vorhandene Konfiguration angezeigt, mit --force wird sie überschrieben:

nl-export konfig --show
nl-export konfig --force

Nutzung

Lizenznehmer exportieren (lzn)

# CSV-Export (Standard)
nl-export lzn https://cms.example.de/lizenzmodell/eindeutige-id

# XML-Export mit Schema v2
nl-export lzn --format xml --version 2 https://cms.example.de/lizenzmodell/eindeutige-id

# JSON-Export in ein bestimmtes Verzeichnis
nl-export lzn --format json --ablage /pfad/zum/exportverzeichnis \
    https://cms.example.de/lizenzmodell/eindeutige-id

# Nur ASCII-Zeichen in Dateinamen verwenden
nl-export lzn --only-ascii https://cms.example.de/lizenzmodell/eindeutige-id

# Nach Status filtern (mehrfach möglich)
nl-export lzn --status published --status expired https://cms.example.de/lizenzmodell/eindeutige-id

# Mit UUID statt voller URL
nl-export lzn 123e4567-e89b-12d3-a456-426614174000

# Mehrere Lizenzmodelle auf einmal
nl-export lzn https://cms.example.de/lizenzmodell/1 https://cms.example.de/lizenzmodell/2

Die Exportdateien werden standardmäßig im aktuellen Verzeichnis abgelegt (ä̈nderbar mit --ablage).

Versionen des Export-Schemas

Version Beschreibung
v1 Basis-Schema
v2 Erweitertes Schema
v3 Schema mit ip_proxy_server und use_theipregistry_org-Feldern

Proxy-Konfiguration exportieren (proxy)

# Standard-Ausgabe nach ./lmodels_singleuser.csv
nl-export proxy

# Ausgabe in eine bestimmte Datei
nl-export proxy --csvdatei /pfad/zur/datei.csv

Allgemeine Optionen

# Ausführliche Ausgabe
nl-export -v

Ausgabeformate

CSV

  • Trennzeichen: Semikolon (;)
  • Alle Felder in Anführungszeichen (QUOTE_ALL)
  • UTF-8-Kodierung

XML

  • Namespace: http://www.nationallizenzen.de/ns/nl
  • UTF-8-Kodierung

JSON

  • Strukturierte JSON-Dateien
  • UTF-8-Kodierung

Entwicklung

Tests ausführen

python3 -m pytest src/nl/export/test/ -v

Linting und Formatierung

ruff check --fix src/
ruff format src/

Lizenz

GNU Affero General Public License v3 (AGPL-3.0).

Copyright (c) 2019-2026 Verbundzentrale des GBV (VZG).

Siehe COPYING oder GNU AGPL v3.

Metadata

Release files for nl.export 1.5.1

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

Source distribution (sdist)

Source distribution for nl.export 1.5.1
File Size Uploaded Provenance Actions
nl_export-1.5.1.tar.gz 32.6 kB Without provenance Details for nl_export-1.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nl.export 1.5.1
File Interpreter ABI Platform Actions
nl_export-1.5.1-py3-none-any.whl Python 3 none any Details for nl_export-1.5.1-py3-none-any.whl

Total release size: 73.1 kB

Release files / nl_export-1.5.1.tar.gz

Download URL nl_export-1.5.1.tar.gz
Size 32.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2aa81617a5f9d31e5393ef53efe43943b8cfdb572e52a899474746f642c462f2
BLAKE2b-256 checksum
How to use checksums
0f74a9f51d6b19aaa84de5e8bbd49e331ee2f0b4f0030a5323f8f9c1bda866db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / nl_export-1.5.1-py3-none-any.whl

Download URL nl_export-1.5.1-py3-none-any.whl
Size 40.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab4d9f0bffbc9b9eb0be952d1b0b65b3a20285fc5b9ad009352ad7f9b25c48b5
BLAKE2b-256 checksum
How to use checksums
4d4bdd799a710c7cc0636455fd330d87e56ddafd292a503f6da2c1eb0c6c46ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for nl.export 1.5.1

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