Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tjvr/scratch-wiki-client
A really simple MediaWiki API client for the Scratch Wiki.
https://github.com/tjvr/scratch-wiki-client
Last synced: 3 days ago
JSON representation
A really simple MediaWiki API client for the Scratch Wiki.
- Host: GitHub
- URL: https://github.com/tjvr/scratch-wiki-client
- Owner: tjvr
- License: mit
- Created: 2013-05-07T16:36:26.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-05-07T16:41:06.000Z (over 11 years ago)
- Last Synced: 2024-11-18T04:23:07.729Z (about 1 month ago)
- Language: Python
- Size: 105 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
A really simple MediaWiki API client for the Scratch Wiki.
Can:
* read pages
* edit pages
* list pages in category
* list page backlinks ("what links here")
* list page transclusionsRequires the ``requests`` library.
http://wiki.scratch.mit.edu/
Example Usage
=============Get a page::
wiki = ScratchWiki()
wiki.login("blob8108", password)
sandbox = wiki.page("User:Blob8108/Sandbox")
Edit page::
# Get the page
contents = sandbox.read()# Change
contents += "\n This is a test!"
summary = "Made a test edit"# Submit
sandbox.edit(contents, summary)List pages in category::
for page in wiki.category_members("Redirects"):
print page.titleRemove all uses of a template::
target_pages = wiki.transclusions("Template:unreleased")
# Sort by title because it's prettier that way
target_pages.sort(key=lambda x: x.title)
# Main namespace only
target_pages = [p for p in target_pages if p.query_info()['ns'] == 0]
for page in target_pages:
page.replace("{{unreleased}}", "")Made by ~blob8108.
MIT Licensed.