====Pywikibot====
Wikimedia automation scripts.
===Clone===
git clone --recursive https://github.com/wikimedia/pywikibot
Perform all future operations inside the pywikibot repository directory.
cd pywikibot
===Install===
python3 -m venv ~/.venvs/pywikibot
~/.venvs/pywikibot/bin/python -m pip install -r requirements.txt
===Config===
First create a family file.
~/.venvs/pywikibot/bin/python pwb.py generate_family_file.py
Enter the URL and name to create a family file for the private site.
Select no when asked about interwiki links.
Eg.
from pywikibot import family
class Family(family.Family): # noqa: D101
name = 'MySite'
langs = {
'en': 'www.example.com',
}
def version(self, code):
return "1.4.3" # The MediaWiki version used.
def scriptpath(self, code):
return {
'en': '/w',
}[code]
def protocol(self, code):
return {
'en': 'https',
}[code]
Next a user configuration is needed.
cp user-config.py.sample user-config.py
vi user-config.py
Eg.
mylang = 'en'
family = 'MySite'
usernames['MySite']['en'] = 'Mybot'
Lastly run the login script to enter the password.
~/.venvs/pywikibot/bin/python pwb.py login -v -v
===Examples===
~/.venvs/pywikibot/bin/python pwb.py
source ~/.venvs/pywikibot/bin/activate.csh
./pwb.py welcome.py
deactivate
===Resources====
[[https://github.com/wikimedia/pywikibot|Github]]|
[[https://doc.wikimedia.org/pywikibot/stable/|Documentation]]
[[https://www.mediawiki.org/wiki/Manual:Pywikibot/Use_on_third-party_wikis|Third party wikis]]
[[https://www.mediawiki.org/wiki/Manual:Pywikibot/Wikidata|Wikidata]]