I posted this yesterday about 15 hours ago and don't see it yet, so I'm
reposting:
I'm new to anything Python related. I downloaded pywikimedia yesterday and
am trying to get this to work.
This is my dump from
api.php?action=query&meta=siteinfo&siprop=general|namespaces|namespacealiases|statistics
[QUOTE]
<?xml version="1.0"?>
<api>
<query>
<general mainpage="Main Page" base=
"http://www.locksmithwiki.com/lockwiki/index.php/Main_Page"<http://www.locksmithwiki.com/lockwiki/index.php/Main_Page>sitename="Locksmith
Wiki Knowledge Base" generator="MediaWiki 1.15.1"
case="first-letter" rights="" lang="en"
fallback8bitEncoding="windows-1252"
writeapi="" timezone="UTC" timeoffset="0" />
<namespaces>
<ns id="-2" canonical="Media"
xml:space="preserve">Media</ns>
<ns id="-1" canonical="Special"
xml:space="preserve">Special</ns>
<ns id="0" xml:space="preserve" />
<ns id="1" subpages="" canonical="Talk"
xml:space="preserve">Talk</ns>
<ns id="2" subpages="" canonical="User"
xml:space="preserve">User</ns>
<ns id="3" subpages="" canonical="User talk"
xml:space="preserve">User
talk</ns>
<ns id="4" canonical="Project"
xml:space="preserve">Locksmith Wiki
Knowledge Base</ns>
<ns id="5" subpages="" canonical="Project talk"
xml:space="preserve">Locksmith Wiki Knowledge Base talk</ns>
<ns id="6" canonical="File"
xml:space="preserve">File</ns>
<ns id="7" subpages="" canonical="File talk"
xml:space="preserve">File
talk</ns>
<ns id="8" canonical="MediaWiki"
xml:space="preserve">MediaWiki</ns>
<ns id="9" subpages="" canonical="MediaWiki talk"
xml:space="preserve">MediaWiki talk</ns>
<ns id="10" canonical="Template"
xml:space="preserve">Template</ns>
<ns id="11" subpages="" canonical="Template talk"
xml:space="preserve">Template talk</ns>
<ns id="12" canonical="Help"
xml:space="preserve">Help</ns>
<ns id="13" subpages="" canonical="Help talk"
xml:space="preserve">Help talk</ns>
<ns id="14" canonical="Category"
xml:space="preserve">Category</ns>
<ns id="15" subpages="" canonical="Category talk"
xml:space="preserve">Category talk</ns>
</namespaces>
<namespacealiases>
<ns id="6" xml:space="preserve">Image</ns>
<ns id="7" xml:space="preserve">Image talk</ns>
</namespacealiases>
<statistics pages="8930" articles="3406"
views="87415" edits="15885"
images="760" users="264" activeusers="1"
admins="2" jobs="0" />
</query>
</api>
[/QUOTE]
This is my current "lockwiki_family.py" file (I removed the commented out
lines):
[QUOTE]
# -*- coding: utf-8 -*- # REQUIRED
import config, family, urllib # REQUIRED
class Family(family.Family): # REQUIRED
def __init__(self): # REQUIRED
family.Family.__init__(self) # REQUIRED
self.name = 'Locksmith Wiki Knowledge Base' # REQUIRED;
replace with actual name
self.langs = { # REQUIRED
'en': 'www.locksmithwiki.com', # Include one line for each
wiki
in family
}
self.namespaces[4] = {
'_default': [u'Locksmith Wiki Knowledge Base',
self.namespaces[4]['_default']], # REQUIRED
}
self.namespaces[-2] = { 'en': 'Media' }
self.namespaces[-1] = { 'en': 'Special' }
self.namespaces[1] = { 'en': 'Talk' }
self.namespaces[2] = { 'en': 'User' }
self.namespaces[3] = { 'en': 'User talk' }
self.namespaces[4] = { 'en': 'Locksmith Wiki Knowledge Base' }
self.namespaces[5] = { 'en': 'Locksmith Wiki Knowledge Base talk' }
self.namespaces[6] = { 'en': 'File' }
self.namespaces[7] = { 'en': 'File talk' }
self.namespaces[8] = { 'en': 'MediaWiki' }
self.namespaces[9] = { 'en': 'MediaWiki talk' }
self.namespaces[10] = { 'en': 'Template' }
self.namespaces[11] = { 'en': 'Template talk' }
self.namespaces[12] = { 'en': 'Help' }
self.namespaces[13] = { 'en': 'Help talk' }
self.namespaces[14] = { 'en': 'Category' }
self.namespaces[15] = { 'en': 'Category talk' }
self.content_id = "bodyContent"
self.interwiki_text_separator = '\r\n\r\n'
self.interwiki_putfirst = {}
self.interwiki_putfirst_doubled = {}
self.interwiki_forward = None
self.obsolete = {}
self.category_attop = []
self.category_on_one_line = []
self.category_text_separator = '\r\n\r\n'
self.categories_last = []
def protocol(self, code):
"""
Can be overridden to return 'https'. Other protocols are not
supported.
"""
return 'http'
def scriptpath(self, code):
"""The prefix used to locate scripts on this wiki.
This is the value displayed when you enter {{SCRIPTPATH}} on a
wiki page (often displayed at [[Help:Variables]] if the wiki has
copied the master help page correctly).
The default value is the one used on Wikimedia Foundation wikis,
but needs to be overridden in the family file for any wiki that
uses a different value.
"""
return '/lockwiki'
def apipath(self, code):
return '%s/api.php' % self.scriptpath(code)
def version(self, code):
# Replace with the actual version being run on your wiki
return '1.15.1'
def code2encoding(self, code):
"""Return the encoding for a specific language
wiki"""
return 'utf-8'
[/QUOTE]
When I go to login.py the screen flashes and closes within a second.
I did have
self.name = 'Locksmith Wiki Knowledge Base' # REQUIRED;
replace with actual name
and
self.namespaces[4] = {
'_default': [u'Locksmith Wiki Knowledge Base',
self.namespaces[4]['_default']], # REQUIRED
}
set as
self.name = 'lockwiki' # REQUIRED; replace with actual name
and
self.namespaces[4] = {
'_default': [u'lockwiki',
self.namespaces[4]['_default']], #
REQUIRED
}
and that let me at least enter my password, but the screen closed so quickly
I couldn't read the several lines of type that flashed up shortly
afterwards.
What am I doing wrong here?