Use MediaWiki Wiki page content as read-only database
Project description
wiki_as_base-py
[MVP] Use MediaWiki Wiki page content as read-only database. Python library implementation. See https://github.com/fititnt/openstreetmap-serverless-functions/tree/main/function/wiki-as-base
Installing
pip install wiki_as_base --upgrade
Usage
Environment variables
Customize for your needs. They're shared between command line and the library.
export WIKI_API='https://wiki.openstreetmap.org/w/api.php'
Command line
wiki_as_base --help
## Use remote storage (defined on WIKI_API)
wiki_as_base --page-title 'User:EmericusPetro/sandbox/Wiki-as-base'
# The output is JSON-LD. Feel free to further filter the data
wiki_as_base --page-title 'User:EmericusPetro/sandbox/Wiki-as-base' | jq .data[0]
## Example of, instead of use WIKI_API, parse Wiki markup directly. Output JSON- LD
cat tests/data/multiple.wiki.txt | wiki_as_base --input-stdin
## Output zip file instead of JSON-LD. --verbose also adds wikiasbase.jsonld to file
cat tests/data/chatbot-por.wiki.txt | wiki_as_base --input-stdin --verbose --output-zip-file tests/temp/chatbot-por.zip
Library
WARNING: as 2023-12-05 while the command line is less likely to change, the internal calls of this library, names of functions, etc are granted to not be stable.
You can import as a pip package, however set the exact version in special if it is unnatended deployment (e.g. GitHub actions, etc).
# requirements.txt
wiki_as_base==0.5.2
The Specification
The temporary docs page is at https://fititnt.github.io/wiki_as_base-py/
Disclaimer / Trivia
The wiki_as_base allows no-as-complete data extraction from MediaWiki markup text directly by its API or direct input, without need to install server extensions.
Check also the wikimedia/Wikibase, a full server version (which inspired the name).
License
Public domain
Project details
Release history Release notifications | RSS feed
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
Hashes for wiki_as_base-0.5.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c81b4f8895fb3fc3f66ec5de6f56f457c0d655a469e54ae7330e61e00bebd54 |
|
MD5 | 56670de6fccd0b3f852219b3dfc3dfe8 |
|
BLAKE2b-256 | 8aaf616730b4041b58483563f256359bd090b81d7fa2c74864518d4691a75680 |