Bugs item #3585132, was opened at 2012-11-07 04:36
Message generated for change (Comment added) made by throwy
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=358513…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: General
Group: trunk
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Throwy (throwy)
Assigned to: Nobody/Anonymous (nobody)
Summary: Wikia returns cached pages for get.py editarticle.py
Initial Comment:
get.py and editarticle.py use a method of page fetching that results in cached pages from
Wikia
replace.py uses the pagegenerator method, which fetches the latest version of pages from
Wikia
The issue is probably a Wikia issue, but it would be nice to implement a workaround in
pywikipediabot.
Steps to reproduce:
Create or edit a page on a Wikia wiki. Fetch the page with editarticle.py or get.py . The
bot should fetch a cached version. Edit the page with replace.py and the bot should fetch
the most recent version, which is the expected behavior.
Comments:
Someone had already solved this issue for me on #pywikipediabot on freenode. It requires
very little alteration to get.py and editarticle.py. Unfortunately I did not back up or
document the changes before updating pywikipediabot from SVN and the changes were lost.
----
$ python version.py
Pywikipedia [http] trunk/pywikipedia (r10663, 2012/11/04, 19:53:31)
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
config-settings:
use_api = True
use_api_login = True
unicode test: ok
----------------------------------------------------------------------
Comment By: Throwy (throwy)
Date: 2012-11-09
10:11
Message:
I found the patched editarticle.py on pastebin, woohoo!
<pre>33a34
import pagegenerators
157c158
< self.page = pywikibot.Page(site, pageTitle)
---
self.page =
iter(pagegenerators.PreloadingGenerator([pywikibot.Page(site,
pageTitle)])).next()</pre>
----------------------------------------------------------------------
Comment By: xqt (xqt)
Date: 2012-11-07 05:56
Message:
Some remarks:
I changed the hostname() in family file to "mlp.wikia.com" and used the
following statements:
import wikipedia as wp
s = wp.getSite('wikia', 'wikia')
p = wp.Page(s, 'Template:Date/doc')
t = p.get(force=True)
result:
Traceback (most recent call last):
File "<pyshell#69>", line 1, in <module>
t = p.get(force=True)
File "wikipedia.py", line 699, in get
expandtemplates = expandtemplates)
File "wikipedia.py", line 800, in _getEditPage
"Page does not exist. In rare cases, if you are certain the page does
exist, look into overriding family.RversionTab")
NoPage: (wikia:wikia, u'[[wikia:Template:Date/doc]]', 'Page does not exist.
In rare cases, if you are certain the page does exist, look into overriding
family.RversionTab')
the query param dict was:
{'inprop': ['protection', 'subjectid'], 'rvprop':
['content', 'ids',
'flags', 'timestamp', 'user', 'comment', 'size'],
'prop': ['revisions',
'info'], 'titles': u'Template:Date/doc', 'rvlimit': 1,
'action': 'query'}
the result data dict was:
{u'query': {u'pages': {u'-1': {u'protection': [],
u'ns': 10, u'missing':
u'', u'title': u'Template:Date/doc'}}}}
and last the url is:
/api.php?inprop=protection%7Csubjectid&format=json&rvprop=content%7Cids%7Cflags%7Ctimestamp%7Cuser%7Ccomment%7Csize&prop=revisions%7Cinfo&titles=Template%3ADate/doc&rvlimit=1&action=query
which gives the right result via browser e.g.:
http://mlp.wikia.com/api.php?inprop=protection%7Csubjectid&format=json&…
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=358513…