Free Software Directory:Pywikibot

From Free Software Directory
Revision as of 06:14, 12 June 2018 by David Hedlund (talk | contribs)

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

MediaWiki

  • Add this to LocalSettings.php
# Allow batch uploading for pywikibot
$wgGrantPermissions['editprotected']['editarticles'] = true;

Generate a bot account for your user

The bot will be associated with the user name that are logged in.

pywikibot

sudo apt-get install python-pip
sudo pip install --upgrade pip
git clone https://gerrit.wikimedia.org/r/pywikibot/core pywikibot-core
cd pywikibot-core
python generate_family_file.py 'http://directory.fsf.org/wiki/Main_Page' 'freesoftwaredirectorydev'
python pwb.py generate_user_files
# Select family of sites we are working on, just enter the number or name (default: wikipedia): freesoftwaredirectorydev
# The only known language: en
# The language code of the site we're working on (default: en): 
# Username on en:freesoftwaredirectorydev: WikiSysop
# Do you want to add any other projects? ([y]es, [N]o): n
# Do you want to add a BotPassword for WikiSysop? ([y]es, [N]o, [q]uit): y
# See https://www.mediawiki.org/wiki/Manual:Pywikibot/BotPasswords to
# know how to get codes.Please note that plain text in /home/root
# /pywikibot-core/user-password.py and anyone with read access to that
# directory will be able read the file.
# BotPassword's "bot name" for WikiSysop: wikibot
# BotPassword's "password" for "WikiSysop" (no characters will be shown): 
# '/home/root/pywikibot-core/user-config.py' written.

Test pywikibot on MediaWiki

python pwb.py upload -always -ignorewarn ~/heckert_gnu.transp.small.png "Some description"

Further reading

Read https://www.mediawiki.org/wiki/Manual:Importing_XML_dumps#Using_pywikibot,_pagefromfile.py_and_Nokogiri for more information



Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the page “GNU Free Documentation License”.

The copyright and license notices on this page only apply to the text on this page. Any software or copyright-licenses or other similar notices described in this text has its own copyright notice and license, which can usually be found in the distribution or license text itself.