You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
489 B
Python
20 lines
489 B
Python
import mwclient
|
|
|
|
# 1. Connect to the Mediawiki client logging in as a user
|
|
site = mwclient.Site('pzwiki.wdka.nl', path='/mw-mediadesign/')
|
|
site.login(
|
|
username='username',
|
|
password='password'
|
|
)
|
|
|
|
# 2. Get a page to edit. If it doesn't exist it will be created
|
|
page = site.pages['A test page']
|
|
|
|
# 3. Get the text from the page
|
|
text = page.text()
|
|
|
|
# 4. Edit the contents
|
|
text += 'Editing the test page from the wiki'
|
|
|
|
# 5. Write the modification
|
|
page.edit(text, 'Summary of the edit') |