User:Geertivp/Training/Pywikibot/Install

pywikibot is a well-known Python Wiki bot.

It can be used with Wikimedia projects, as well as on a private Mediawiki server.

Here we will document how to use it on Wikimedia projects.

Prerequisites
pip install requests But this is already installed on a Mediawiki server.
 * Python

Install
wget http://tools.wmflabs.org/pywikibot/core.tar.gz Now restore it in a user account: tar -xf core.tar.gz

mv core pywikibot

Configure
cd pywikibot

python pwb.py generate_user_files

vi user-config.py

touch user-password.py chmod 600 user-password.py vi user-password.py

Test your setup
Test your login account: python pwb.py login Show user page: python pwb.py shell

User script
cp scripts/basic.py scripts/userscripts/getuserpage.py

vi scripts/userscripts/getuserpage.py

python pwb.py getuserpage

Create a page
python pwb.py shell

import pywikibot site = pywikibot.Site page = pywikibot.Page(site, u'User:Geertivp/Pywikibot test') print page text=page.text print text page.text=u'Pywikibot test' page.save(u'Pywikibot test')

Wikimedia links

 * Tools/Editing tools


 * mw:Manual:Pywikibot
 * mw:Manual:Pywikibot/Installation
 * mw:Manual:Pywikibot/Create your own script


 * https://doc.wikimedia.org/pywikibot