[SOLVED] problem in pywikibot login to third-party wiki
[SOLVED] problem in pywikibot login to third-party wiki
When I want to login with bot to my wiki I see this error:
No handlers could be found for logger "pywiki" Logging in to westeros:fa as SiteBot via API. Traceback (most recent call last): File "C:\pywikipedia\login.py", line 436, in <module> main() File "C:\pywikipedia\login.py", line 432, in main loginMan.login() File "C:\pywikipedia\login.py", line 319, in login cookiedata = self.getCookie(api) File "C:\pywikipedia\login.py", line 181, in getCookie response, data = query.GetData(predata, self.site, sysop=self.sysop, back_response = True) File "C:\pywikipedia\pywikibot\support.py", line 121, in wrapper return method(*__args, **__kw) File "C:\pywikipedia\query.py", line 143, in GetData res, jsontext = site.postForm(path, params, sysop, site.cookies(sysop = sysop) ) File "C:\pywikipedia\wikipedia.py", line 6460, in postForm cookies=cookies) File "C:\pywikipedia\wikipedia.py", line 6514, in postData raise PageNotFound(u'Page %s could not be retrieved. Check your family file ?' % url) pywikibot.exceptions.PageNotFound: Page http://www.westeros.ir/w/api.php could not be retrieved. Check your family file?
My family file is this:
# -*- coding: utf-8 -*- import family # westeros class Family(family.Family): def __init__(self): family.Family.__init__(self) self.name = 'westeros' self.langs = { 'fa': 'www.westeros.ir', } def version(self, code): return "1.19.3" def scriptpath(self, code): return '/wiki' def apipath(self, code): return '/wiki'
api.php is in '/wiki' folder, why it says "Page http://www.westeros.ir/w/api.php could not be retrieved"? Where should I change "/w" to "/wiki" other than family.py file?
You should be using http://westeros.ir/wiki/api.php for your api.php. BTW: added to wikiapiary.
☠MarkAHershberger☢(talk)☣
Yes, as you see I want use http://westeros.ir/wiki/api.php and defined apipath in westeros_family.py file like this:
def apipath(self, code): return '/wiki'
I wonder why I'm receiving this error. I never mentioned '/w' folder anywhere! Is there any way to fix this?
PS: Thanks for adding to wikiapary.
I'm afraid I don't know much about this. Looks like you got an answer from your post on Pywikipediabot page, though.
☠MarkAHershberger☢(talk)☣