Edit source Talk
< Appropedia:PywikipediabotRedirected from Appropedia:Pywikipedia bot/appropedia family.py

Appropedia:Pywikipediabot/appropedia family.py

From Appropedia

The file appropedia_family.py should be placed in the families folder of your Pywikipedia installation.

Technical notes:

  • The up-to-date list of namespaces can be extracted at any time from namespaces|namespacealiases|here.
  • If the wiki changes its version or namespaces, errors will be generated when running the bot. These usually don't matter, but can be fixed be updating your family file.

appropedia_family.py[edit source]

Add the following text to a text file (using a text editor), and save as appropedia_family.py, in your Pywikipedia/families folder.

# -*- coding: utf-8  -*-
 
import family
 
 # Appropedia.org # Sharing knowledge to build rich, sustainable lives. 
 # This family file is based on the Mozilla family file

class Family(family.Family):
 
     def __init__(self):
         family.Family.__init__(self)
         self.name = 'appropedia' #Set the family name; this should be the same as in the filename.
         self.langs = {
             'en': 'www.appropedia.org', #Put the hostname here.
         }
         self.namespaces[4] = {
             '_default': u'Appropedia', #Specify the project namespace here. Other
         }                               #namespaces will be set to MediaWiki default.

         self.namespaces[5] = {
             '_default': u'Appropedia talk',
         }

         self.namespaces[6] = {
             '_default': u'File',
         }

         self.namespaces[7] = {
             '_default': u'File talk',
         }

         self.namespaces[8] = {
             '_default': u'MediaWiki',
         }

         self.namespaces[9] = {
             '_default': u'MediaWiki talk',
         }

         self.namespaces[10] = {
             '_default': u'Template',
         }

         self.namespaces[11] = {
             '_default': u'Template talk',
         }

         self.namespaces[12] = {
             '_default': u'Help',
         }

         self.namespaces[13] = {
             '_default': u'Help talk',
         }

         self.namespaces[14] = {
             '_default': u'Category',
         }

         self.namespaces[15] = {
             '_default': u'Category talk',
         }

         self.namespaces[100] = {
             '_default': u'Portal',
         }

         self.namespaces[101] = {
             '_default': u'Portal talk',
         }

         self.namespaces[102] = {
             '_default': u'Original',
         }

         self.namespaces[103] = {
             '_default': u'Original talk',
         }

         self.namespaces[106] = {
             '_default': u'Property',
         }

         self.namespaces[107] = {
             '_default': u'Property talk',
         }

         self.namespaces[110] = {
             '_default': u'Form',
         }

         self.namespaces[111] = {
             '_default': u'Form talk',
         }

         self.namespaces[112] = {
             '_default': u'Concept',
         }

         self.namespaces[113] = {
             '_default': u'Concept talk',
         }

         self.namespaces[170] = {
             '_default': u'Filter',
         }

         self.namespaces[171] = {
             '_default': u'Filter talk',
         }

         self.namespaces[274] = {
             '_default': u'Widget',
         }

         self.namespaces[275] = {
             '_default': u'Widget talk',
         }

         self.namespaces[284] = {
             '_default': u'Book',
         }

         self.namespaces[285] = {
             '_default': u'Book talk',
         }

         self.namespaces[420] = {
             '_default': u'Layer',
         }

         self.namespaces[421] = {
             '_default': u'Layer talk',
         }


#If needed, the default(?) namespaces are:   
#   0 	Main 	Talk 	1
#   2 	User 	User talk 	3
#   4 	Wikipedia 	Wikipedia talk 	5
#   6 	File 	File talk 	7
#   8 	MediaWiki 	MediaWiki talk 	9
#   10 	Template 	Template talk 	11
#   12 	Help 	Help talk 	13
#   14 	Category 	Category talk 	15
#   100 	Portal 	Portal talk 	101

         self.category_redirect_templates = {
            '_default': (),
            'en': (u"Category redirect",
                   u"Category redirect3",
                   u"Categoryredirect",
                   u"Catredirect",
                   u"Cat redirect",
                   u"Catredir",),
         }

     def version(self, code):
         return "1.17.0"  #The MediaWiki version used. Not very important in most cases.
 
     def path(self, code):
         return '/index.php' #The path of index.php, look at your wiki address. 
# This line may need to be changed to /wiki/index.php or /w/index.php, 
# depending on the folder where your mediawiki program is located.


     def apipath(self, code):

         return '/api.php' #The path of api.php

     def scriptpath(self, code):

         return '' #empty string - base directory

     def nicepath(self, code):

         return '/' #fix the url to have no /wiki in it, when using "open in [b]rowser"
	 # if your wiki's url form is http://domainname.org/foo/ then use return '/foo/' here