Wiki Aventurica:Robots/Anpassungshinweise zu Snapshot-20050323

aus Wiki Aventurica, dem DSA-Fanprojekt

Nachdem das Pywikipediabot-Paket in das Python-Verzeichnis (z.B. C:\python) kopiert wurde müssen 2 Dateien angepasst werden. Bei anderem Verzeichnispfad natürlich entsprechend anpassen, Linuxuser werden sicher wissen, was sie tun...

wikiaventurica_family.py

Die wichtigsten Anpassungen erfolgen, indem die Datei: wikiaventurica_family.py im Unterverzeichnis C:\python\pywikipediabot\families erzeugt wird, und zwar mit folgendem Inhalt:

# -*- coding: utf-8  -*-
import urllib, family, config

u"""Diese Datei enthaelt die notwendigen Anpassungen, die fuer das Wiki Aventurica
gebraucht werden, damit hier die Robotskripte funktionieren können.
Da familiy.Family vererbt wird, werden alle abweichenden Einstellungen ueberschrieben."""

__version__='$Id: wikiaventurica.py,v 0.2 2005/05/25 14:35:00 Alrik Exp $'
__md5__=''

# The Wikimedia family that is known as Wikipedia, the Free Encyclopedia
class Family(family.Family):
    def __init__(self):
        family.Family.__init__(self)
        self.name = 'wikiaventurica'
        self.langs = {'de':'dsa4.de', }
        # Most namespaces are inherited from family.Family.
        self.namespaces[4] = {
            '_default': u'Wiki Aventurica',
            'de': u'Wiki Aventurica',
        }
        self.namespaces[5] = {
            '_default': u'Wiki Aventurica Diskussion',
           'de': u'Wiki Aventurica Diskussion',
       }
        # Languages that are coded in iso-8859-1
        self.latin1 = ['de']        
    def path(self, code):
        return '/wiki/index.php' #anstatt '/w/index.php'
    def version(self, code):
        return "1.4"
    def code2encoding(self, code):
        """Return the encoding for a specific language wikipedia"""
        return 'iso-8859-1'
    def code2encodings(self, code):
        """Return a list of historical encodings for a specific language
           wikipedia"""
# fuer wikiaventurica brauchen wir nur 'iso-8859-1'            
        return self.code2encoding(code),         #das Komma ist Absicht

user-config.py

Zusaetzlich muss eine spezielle Datei user-config.py im Unterverzeichnis C:\python\pywikipediabot erzeugt werden. Vorschlag fuer den Inhalt:

# -*- coding: utf-8 -*-
username='Name hier eintragen'
mylang='de'
family = 'wikiaventurica'

#Es kann auch das PW hier gespeichert werden, vorausgesetzt login.py wurde entsprechend
#angepasst oder es wird der WAbotTK verwendet.
#password=''

#funktioniert nur, wenn wikipedia.checkLogin() entsprechend angepasst ist
#natuerlich muss hier echtes HTML ueberprueft werden
userlogedintext1='<a href="/wiki/index.php?title=Spezial:Contributions&target='+username+'">'
userlogedintext2='<a href="/wiki/index.php?title=Spezial:Userlogout'

# Slow down the robot such that it never requests a second page within
# 'throttle' seconds.
throttle = 2
# Slow down the robot such that it never makes a second change within
# 'put_throttle' seconds.
put_throttle = 3

# Maximum of pages which can be retrieved by special pages. Increase this if
# you heavily use boilerplate.py, double_redirect.py, and especially if you're
# running solve_disambiguation.py with the -primary argument.
special_page_limit = 100

# the encoding that's used in the user's console, i.e. how strings are encoded
# when they are read by raw_input(). On Windows systems' DOS box, this should
# be 'cp850' ('cp437' for older versions). Linux users might try 'iso-8859-1'
# or 'utf-8'. If this variable is set to None, the default is 'cp850' on
# windows, and iso-8859-1 on other systems

#console_encoding = 'cp1252' #je nach Bedarf

Weitere Dateien

Zumindest im angegebenen Snapshot-20050323 müssten diese beiden Dateien reichen. Hier ist jedenfalls Platz für weitere Änderungen.