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'
export WIKI_INFOBOXES='ValueDescription\nKeyDescription'
export WIKI_DATA_LANGS='yaml\nturtle'
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
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
wiki_as_base-0.5.2.tar.gz
(11.2 kB
view hashes)
Built Distribution
Close
Hashes for wiki_as_base-0.5.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0aa385590c7f62505b66a83ebc4a819e8e5a96eb1a5602b89cef8b46fb2e55a |
|
MD5 | 08dc8c3801ac183f8a45bcc1b58a7653 |
|
BLAKE2b-256 | acb3026098af8eaf95ecb74a8d830c765a9f5f762c57855e671da4b27fe5e7dd |