The ScoutWiki Network server was upgraded on November 20th, 2019. The maintenance is now over. Please inform us in Slack or via email support@scoutwiki.org if you encounter any unexpected errors – it's possible the upgrade has missed something. Thanks and happy scoutwiki'ng!

Bot configuration

From ScoutWiki Network
Revision as of 16:09, 1 August 2016 by Egel (talk | contribs)
Jump to navigation Jump to search

Here is the text of the configuration files which have to be used with the bots based on Python Wikipediabot Framework used on the ScoutWiki Network wikis.

The files can easily be changed to fit any new ScoutWiki whose member would like to use a bot on. The scripts work on the Spanish language "WikiRoca" too.

user-config.py

This script has to be placed in the working directory of your bot.

# -*- coding: utf-8  -*-

family = 'scoutwiki'
# The language code of the site you are editing the most.
mylang = 'xx'

usernames['scoutwiki']['xx'] = u'bot_xx'
usernames['scoutwiki']['scoutmedia'] = u'bot_xx'

When using login, the -lang:XX option has to be used :

  • ~$ python pwb.py login -lang:fr for loging in on Scoutopedia
  • ~$ python pwb.py login -lang:fi for loging in on PartioWiki
  • ~$ python pwb.py login -lang:de for loging in on Pfadiwiki

And do the same lines for every wiki you plan to use your bot on.

When using interwiki, the same option is used to tell the bot on which wiki he's got to work first, he'll then check all the pages on that wiki, and after that, if needed, modify the linked pages on the other wiki to have those linked to the first. If this option is not used, the bot will use its main language as defined by mylang = 'xx'.

Of course, the bot has to be loged on each wiki you want it to be able to write on ...

scoutwiki_family.py

This script has to be placed in the pywikibot/families subdirectory in the working directory of your bot.

# -*- coding: utf-8 -*-
"""
This family file was auto-generated by generate_family_file.py script.

Configuration parameters:
  url = https://nl.scoutwiki.org
  name = scoutwiki

Please do not commit this to the Git repository!
"""
from __future__ import absolute_import, unicode_literals

from pywikibot import family
from pywikibot.tools import deprecated


class Family(family.Family):  # noqa: D101

    name = 'scoutwiki'
    langs = {
        'eo': 'eo.scoutwiki.org',
        'en': 'en.scoutwiki.org',
        'nl': 'nl.scoutwiki.org',
        'pt': 'pt.scoutwiki.org',
        'it': 'it.scoutwiki.org',
        'de': 'de.scoutwiki.org',
        'fr': 'fr.scoutwiki.org',
        'da': 'da.scoutwiki.org',
        'ar': 'ar.scoutwiki.org',
        'uk': 'uk.scoutwiki.org',
        'cs': 'cs.scoutwiki.org',
        'fi': 'fi.scoutwiki.org',
        'sv': 'sv.scoutwiki.org',
        'asso': 'asso.scoutwiki.org',
        'scoutmedia': 'media.scoutwiki.org',
        'hu': 'wiki.cserkesz.hu',
        'es': 'wiki.larocadelconsejo.net',
        'scout-o-wiki': 'www.scout-o-wiki.de',
    }

    interwiki_removals = [ 'ja', 'nds', 'scout-o-wi' ]

    def scriptpath(self, code):
        return {
            'eo': '',
            'en': '',
            'nl': '',
            'pt': '',
            'it': '',
            'de': '',
            'fr': '',
            'da': '',
            'ar': '',
            'uk': '',
            'cs': '',
            'fi': '',
            'sv': '',
            'asso': '',
            'scoutmedia': '',
            'hu': '/w',
            'es': '',
            'scout-o-wiki': '',
        }[code]

    @deprecated('APISite.version()')
    def version(self, code):
        return {
            'eo': u'1.30.2',
            'en': u'1.30.2',
            'nl': u'1.30.2',
            'pt': u'1.30.2',
            'it': u'1.30.2',
            'de': u'1.30.2',
            'fr': u'1.30.2',
            'da': u'1.30.2',
            'ar': u'1.30.2',
            'uk': u'1.30.2',
            'cs': u'1.30.2',
            'fi': u'1.30.2',
            'sv': u'1.30.2',
            'scout-o-wiki': '1.25.5',
        }[code]

    def protocol(self, code):
        return {
            'eo': u'https',
            'en': u'https',
            'nl': u'https',
            'pt': u'https',
            'it': u'https',
            'de': u'https',
            'fr': u'https',
            'da': u'https',
            'ar': u'https',
            'uk': u'https',
            'cs': u'https',
            'fi': u'https',
            'sv': u'https',
            'asso': u'https',
            'scoutmedia': u'http',
            'hu': u'https',
            'es': u'http',
            'scout-o-wiki': u'https',
        }[code]

    closed_wikis = [ ]

    removed_wikis = ['ja', 'nds', 'scout-o-wi']

    def ignore_certificate_error(self, code):
        return True