Skip to content

Instantly share code, notes, and snippets.

Martin Urbanec urbanecm

Block or report user

Report or block urbanecm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import toolforge
import pywikibot
site = pywikibot.Site()
conn = toolforge.connect('cswiki', cluster='analytics')
with conn.cursor() as cur:

This is script for dumping data from old Extension:EducationProgram to wiki, because only SQL dumps were provided (

The requirement for running this script is to have: a) ToolForge access b) some templates (with syntax equivalent to the one Outreach Dashboard currently uses, so if you do have editing from the Dasbhaord enabled, you should have the templates); if you don't have such templates, adapt those from cs.wikipedia. If you want to, you can adapt the script to not require a) or b).

Before running, you must firstly adapt the script for your wiki. This means the following:

  1. Adapt line 7 and line 8 to create correct DB connection and site connection
  2. Adapt line 25, line 40, line 53 and line 54 to your template names.
  3. Adapt summary on line 55

After you have customized the script, you can do the following:

python ~/pwb/scripts/ -regex "==(=*) *Literatura *==(=*)" "==\1 Reference ==\2\n<references />\n\n\0" -excepttext:"Reference" -summary:'Robot: Přidání sekce reference' -start:!
python ~/pwb/scripts/ -regex "==(=*) *Související články *==(=*)" "==\1 Reference ==\2\n<references />\n\n\0" -excepttext:"Reference" -summary:'Robot: Přidání sekce reference' -start:!
python ~/pwb/scripts/ -regex "==(=*) *Související stránky *==(=*)" "==\1 Reference ==\2\n<references />\n\n\0" -excepttext:"Reference" -summary:'Robot: Přidání sekce reference' -start:!
python ~/pwb/scripts/ -regex "==(=*) *Externí odkazy *==(=*)" "==\1 Reference ==\2\n<references />\n\n\0" -excepttext:"Reference" -summary:'Robot: Přidání sekce reference' -start:!
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import pywikibot
import time
import sys
import re
import logging
You can’t perform that action at this time.