Manual:Pywikibot/Use on third-party wikis


 * If you need more help on setting up your pywikipediabot you can come for help on #pywikipediabot @ freenode server.

The pywikipedia bot may be used to do all kind of things that are important for the maintenance of a MediaWiki project. When this software is to be used outside of the Wikimedia projects, some configuration needs to be done.

Some non-Wikimedia projects, or families, are already supported; which is in the families folder in which you downloaded. Using the existing files as examples, it should be easy to adapt the bot to your own project. (Simply modify the existing files, or create a new file in a notebook.txt file, saving the file in the families folder, with a name such as )

Example: Mozilla wiki
The Mozilla Foundation's wiki, wiki.mozilla.org, is a very simple example because it is only available in one language.

This is the contents of families/mozilla_family.py. Hints for you to write your own family specification are underlined.

Example: Memory Alpha
memoryalpha_family.py is the "family" definition of Memory Alpha, www.memory-alpha.org, a Star Trek wiki. This specification is a little bit more difficult because it has several languages.

import family class Family(family.Family): def __init__(self): family.Family.__init__(self) self.name = 'memoryalpha' self.langs = { All available languages are listed here. 'de': None, Because the hostname is the same for all languages, 'en': None, we don't specify it here, but below in the hostname 'nl': None, function. 'sv': None, }        # Most namespaces are inherited from family.Family. self.namespaces[4] = { '_default': u'Memory Alpha', All languages use the same project namespace name. }        self.namespaces[5] = { '_default': u'Memory Alpha talk', 'de': u'Memory Alpha Diskussion', 'nl': u'Overleg Memory Alpha', 'sv': u'Memory Alphadiskussion', }        # A few selected big languages for things that we do not want to loop over # all languages. This is only needed by the titletranslate.py module, so        # if you carefully avoid the options, you could get away without these # for another wiki family. self.biglangs = ['en', 'de'] Not very important def hostname(self,code): return 'www.memory-alpha.org' The same for all languages def path(self, code): return '/%s/index.php' % code The language code is included in the path def version(self, code): return "1.4"
 * 1) -*- coding: utf-8  -*-
 * 1) The Memory Alpha family, a set of StarTrek wikis.

Example: Uncyclopædia
The various Uncyclopædias are slightly more awkward as not all are hosted at the same domain or under the same name. Domain names and paths must be specified individually. Most are Wikia-hosted with the exception of fi: hu: ja: no: pt: sv: and zh-tw:. Some have their own registered domain names and the English-language Uncyclopedia also uses a number of custom namespaces.

The approaches which work for an Uncyclopædia or a Memory Alpha project typically can be adapted to other Wikia.

''Note: There have been subsequent updates and changes, see uncyclopedia:es:usuario:Chixpy/uncyclopedia_family.py for the current version of the Uncyclopedia interwiki bot configuration. There are also unresolved issues in which some interwiki languages are not available from all Uncyclopedia projects; proceed with caution.''

Language
For a single-language site, the language specified does not matter as long as it is consistent between the user-config.py and families/foo_family.py

Login failed. Wrong password?
Pywikipedia does not report anything more useful than success, failure, or host connection failure. If possible, try accessing the web server logs (apache uses access_log by default) and take a look at the URL strings.

Make sure your path is defined appropriately for your wiki in your families file:

See the mozilla configuration for clues.

Mismatched interwiki configuration
In some projects (such as Uncyclopedia), each language operates as an independent wiki. This may mean that interwiki tables differ from one individual wiki to another within the same project. Interwiki.py is built on the assumption that, if outbound interlanguage links are available at all from a language, the list of available link-destination languages and the destination URL for each will match perfectly across all wikis in the project.

This leads to some potential pitfalls:
 * If one language is missing outbound language interwiki support entirely, one must avoid giving pywikipediabot an account on that wiki (in user-config.py) in order to ensure that interwiki.py leaves that one language wiki untouched.
 * If one language is using a valid but incomplete interwiki table, running interwiki.py on that language wiki will create broken links. Unlike the case where one language is missing project-wide, there is no clean and easy workaround.
 * If a language in a project has been forked (not just mirrored), the interwiki for each individual language pair will point to only one of the multiple forks. Verify the wiki your bot is looking at is the same one that is being linked from the wiki you're editing - otherwise the bot will delete some valid links as "page does not exist".

Customisation of namespaces
Some projects use non-standard extensions to provide Special:Interwiki and Special:Namespaces lists; where available, these lists should be checked against the configuration files to detect any additional namespace customisations.