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 anzeigenlzn— 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
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
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).
Siehe COPYING oder GNU AGPL v3.
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 nl_export-1.5.0.tar.gz.
File metadata
- Download URL: nl_export-1.5.0.tar.gz
- Upload date:
- Size: 32.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72ee237a563029a7f3999025cfe1d30c28255141f6f4b9c8925ddbefcf7baa6b
|
|
| MD5 |
ae3c9503d89ac93b87fc556b6018a4ee
|
|
| BLAKE2b-256 |
cce329f95b2d19e9ea8b7caa8f159fbbef9aac173be5c2039913d413bc6d0a74
|
File details
Details for the file nl_export-1.5.0-py3-none-any.whl.
File metadata
- Download URL: nl_export-1.5.0-py3-none-any.whl
- Upload date:
- Size: 41.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5392664f70f5595854264f11839a4201e01c81fbe5bb603310e89764d7c2bc50
|
|
| MD5 |
fa37dc6b20dd19aafdc39fb2b5980745
|
|
| BLAKE2b-256 |
fee19088b49e03d5106f9bfbdea4448ddad7751dfd8ba02df411049e8a829eef
|