Skip to main content

[RFC] Semantic Conventions for OpenStreetMap™ 2023 - Python library example

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

GitHub Pypi: 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


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.4.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

wiki_as_base-0.4.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file wiki_as_base-0.4.0.tar.gz.

File metadata

  • Download URL: wiki_as_base-0.4.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.8.2 pkginfo/1.7.0 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for wiki_as_base-0.4.0.tar.gz
Algorithm Hash digest
SHA256 3b8edb2424e5cdb81a1c203f1186f0e3c7560ab94063f8c4ef9c9cad9602e221
MD5 964425b2249bb68f20b92b51ad14396f
BLAKE2b-256 c12cf211380cee7c644cb7ea1fe8f9ee9bc0af16d986a68a8f955ae1ceda4bc4

See more details on using hashes here.

File details

Details for the file wiki_as_base-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: wiki_as_base-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.8.2 pkginfo/1.7.0 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for wiki_as_base-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 99b4e8202b42298407f45dfc78f35a87db9a4fdcc14a4eca89c258d43ad03895
MD5 343ff38d9a488ca40cc55beadbd01c81
BLAKE2b-256 1bfa78769fb23baa9c33f82d9bb423112eeb5f7f8e96d9ff654d083935c0bb27

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page