Hi,
I'm playing with pywikibot. I have a mediawiki on my local machine, for
testing.
I want to extract the text from a page in it, the page being <
http://127.0.0.1/mw/index.php/Cabalamat:Test_Article>gt;,
so I have tried this code:
localMw = pywikibot.Site(
url="http://127.0.0.1/mw/index.php/")
page = pywikibot.Page(localMw, "Cabalamat:Test_Article")
however, I get this error message:
Traceback (most recent call last):
File "simple.py", line 27, in <module>
url="http://127.0.0.1/mw/index.php/")
File
"/home/phil/sproj/wfbots/venv/local/lib/python2.7/site-packages/pywikibot/__init__.py",
line 1214, in Site
raise SiteDefinitionError("Unknown URL '{0}'.".format(url))
pywikibot.exceptions.SiteDefinitionError: Unknown URL '
http://127.0.0.1/mw/index.php/'#39;.
<class 'pywikibot.exceptions.SiteDefinitionError'>
CRITICAL: Closing network session.
Looking at the documentation, it says <
https://doc.wikimedia.org/pywikibot/api_ref/pywikibot.html#pywikibot.Site&g…gt;:
*url* (*string*) – Instead of code and fam, does try to get a Site based on
the URL. Still requires that the family supporting that URL exists.
From this I get the impression that pywikibot has a
list of mediawiki sites
that it recognises, and if a site isn't on that list, it
won't work.
Is that correct or am I misunderstanding something?
--
Phil Hunt, <cabalamat(a)gmail.com>