Establishes a connection to a Wikibase instance and provides methods for interacting with it.
Project description
WBMaker
This alpha package helps establish an authenticated connection with a Wikibase instance and provides a number of functions for building items using the wikibaseintegrator package and working with Wikimedia pages (e.g., "item talk" pages) using the mwclient package. While it is simple enough to work with these packages separately, it is helpful to provide a lightweight layer of abstraction for many of the tasks needed in developing bot-based applications and data processing pipelines.
I am planning on building in additional functionality that I find most commonly used when developing bots that take action on Wikidata or another Wikibase instance.
Installation
pip install wbmaker
or install from source
git clone https://github.com/skybristol/wbmaker
Environment Variables
The WB class operates on a set of environment variables that set up and authorize interactions with a Wikibase instance, including Wikidata. These variables are required by one or both of the underlying packages, wikibaseintegrator and mwclient used in wbmaker. Instantiating the class will prompt for the following basic variables and set them if not supplied in the operating environment.
- WB_URL: base URL for the Wikibase instance (e.g., https://www.wikidata.org/)
- WB_SPARQL_ENDPOINT: SPARQL endpoint for the Wikibase instance (e.g., https://query.wikidata.org/sparql)
- MEDIAWIKI_API: Mediawiki API URL for the Wikibase instance (e.g., https://www.wikidata.org/w/api.php)
WBMaker
This alpha package helps establish an authenticated connection with a Wikibase instance and provides a number of functions for building items using the wikibaseintegrator package and working with Wikimedia pages (e.g., "item talk" pages) using the mwclient package. While it is simple enough to work with these packages separately, it is helpful to provide a lightweight layer of abstraction for many of the tasks needed in developing bot-based applications and data processing pipelines. I am planning on building in additional functionality that I find most commonly used when developing bots that take action on Wikidata or another Wikibase instance.
Installation
pip install wbmaker
or install from source
git clone https://github.com/skybristol/wbmaker
Environment Variables
The WB class operates on a set of environment variables that set up and authorize interactions with a Wikibase instance, including Wikidata. These variables are required by one or both of the underlying packages, wikibaseintegrator and mwclient used in wbmaker. Instantiating the class will prompt for the following basic variables and set them if not supplied in the operating environment.
- WB_URL: base URL for the Wikibase instance (e.g., https://www.wikidata.org/)
- WB_SPARQL_ENDPOINT: SPARQL endpoint for the Wikibase instance (e.g., https://query.wikidata.org/sparql)
- MEDIAWIKI_API: Mediawiki API URL for the Wikibase instance (e.g., https://www.wikidata.org/w/api.php)
- WB_BOT_USER_AGENT: the user agent string to use in actions; link to code and/or contact information encouraged (e.g., "MyBot/1.0")
If you will be making edits, the following are also required. If these are not provided, the login section of the class will not be invoked, and you will be limited to read-only operations.
- WB_BOT_USER: bot user name authorized to operate on the Wikibase instance
- WB_BOT_PASS: bot user's password
If you will be making edits, the following are also required. If these are not provided, the login section of the class will not be invoked, and you will be limited to read-only operations.
- WB_BOT_USER: bot user name authorized to operate on the Wikibase instance
- WB_BOT_PASS: bot user's password
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
File details
Details for the file wbmaker-0.0.9.tar.gz
.
File metadata
- Download URL: wbmaker-0.0.9.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42ee6cc0b600fc5967128096e6738f4812982d4250aa4b3210ba2af0fff25522 |
|
MD5 | bdd1e09eba519db60572245b3d18c29e |
|
BLAKE2b-256 | 2d852e4ecfe7c16c310a58b1677833f10418348af9d52dcf63390d5d8936765d |
File details
Details for the file wbmaker-0.0.9-py3-none-any.whl
.
File metadata
- Download URL: wbmaker-0.0.9-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b626a2018e05e342d3ca6b079ae6eeadf6e7153d23094da14170c3c25995b467 |
|
MD5 | 53ee8b9252aa17288458a24b5768298f |
|
BLAKE2b-256 | 99990486cbe0bab4b67da31a6a158da1b210e7efbdfc4fe7867f3d3abba61098 |