Hi,
I have a headache because of the new script. apispec.py. Site parameter behaves very strange. My intention was to give an optional site parameter to __init__ in class Blocks. If it is not given explicitely, a getSite() has to be run.
Now, my bot's home wiki is huwiki. It has in this moment 2 blocks that will expire in 1 day (one of them expires by the time you read this, unfortunately, but is important, and according to my experiences it will be displayed today until midnight). Data for block #37947 Blocked user: n/a (autoblock) Admin: Pagony (#121148) Beginning in UTC: 2012-02-04 16:04:22 Expiry in UTC: 2012-02-05 16:04:22 Flags: automatic, nocreate Reason: Az általad használt IP-cím [[Wikipédia:Autoblokk|autoblokkolva]] van, mivel korábban a blokkolt "[[User:Magyarihun|Magyarihun]]" használta. (Magyarihun blokkolásának indoklása: "'''blokk kijátszása'''") Ha nem te vagy Magyarihun, lépj
Data for block #37940 Blocked user: 89.149.56.249 Admin: Malatinszky (#55605) Beginning in UTC: 2012-02-02 14:47:29 Expiry in UTC: 2012-02-06 06:47:29 Flags: anononly, nocreate, allowusertalk Reason:
I run the attached sample code. It is very short. Now, if I leave the parentheses of getSite empty or I write ('hu'), it works well. For many other codes such as 'fr', 'de', 'ar' it works well, too, and gives the appropriate list of blocks expiring within 24 hours from that wiki. But! If I write ('en'), the result is the appropriate list from enwiki PLUS the two Hungarian blocks at the end. Writing 'ru' is even stranger, because it returns the blocks from ruwiki plus only the second one of the huwiki's blocks at the end (the first one is not even inside the list, I checked).
If I omit detecting and passing site, and give the code directly in the beginning of apispec.py, the result is the same. Where is the error?
TIA,
On 5 February 2012 17:14, Bináris wikiposta@gmail.com wrote:
(long story)
Do some debugging. Set the debug flag on, so that you can see which queries are output. Use some well-placed print statements, or use pdb to set some breakpoints at sensible locations.
Best, Merlijn
2012/2/5 Merlijn van Deen valhallasw@arctus.nl
Do some debugging. Set the debug flag on, so that you can see which queries are output.
I tried to investigate this thing. As far as I see, -debug is for internal use in wikipedia.py, getall uses it, but has no general effect on bots, or has it? I have not known this since it is not documented in global help, but at least now I know why does it not work in my other script. :-)
On 9 February 2012 10:37, Bináris wikiposta@gmail.com wrote:
2012/2/5 Merlijn van Deen valhallasw@arctus.nl
Do some debugging. Set the debug flag on, so that you can see which queries are output.
I tried to investigate this thing. As far as I see, -debug is for internal use in wikipedia.py, getall uses it, but has no general effect on bots, or has it? I have not known this since it is not documented in global help, but at least now I know why does it not work in my other script. :-)
Sorry, this wasn't really clear in my original mail. I actually meant the 'debug' global, which is set by the -v flag (can be used multiple times). This shows the API queries used.
Best, Merlijn
pywikipedia-l@lists.wikimedia.org