mwapi
A MediaWiki API client library.
mwapi is a low-level library for the MediaWiki Action API.
If you intend to edit pages or want a higher-level interface, it's recommended to use mwbot,
which builds on top of this crate.
Goals
- generic to fit any application, whether for interactive usage or writing a bot
- fully compatible with concurrent use cases
- turns MediaWiki errors into Rust errors for you
- logging (using the
tracingcrate) for visiblity into errors - follow all best practices
Quick start
let client = builder
.set_user_agent
// Provide credentials for login:
// .set_botpassword("username", "password")
.build.await?;
let resp = client.get_value.await?;
let info = resp.clone;
assert_eq!;
assert_eq!;
Functionality
- authentication, using OAuth2 (recommended) or BotPasswords
- error handling, transforming MediaWiki errors into Rust ones
- CSRF token handling with
post_with_token - rate limiting and concurrency controls
- file uploads (needs
uploadfeature)
See also
mwbotprovides a higher level interface to interacting with MediaWikimwapi_responsesis a macro to generate strict types for dynamic API queries
Contributing
mwapi is a part of the mwbot-rs project.
We're always looking for new contributors, please reach out
if you're interested!
License
This crate is released under GPL-3.0-or-later. See COPYING for details.