https://bugzilla.wikimedia.org/show_bug.cgi?id=70766
Bug ID: 70766 Summary: It is using the user configured site, even though another site was requested Product: Pywikibot Version: core (2.0) Hardware: All OS: All Status: NEW Severity: normal Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: CommodoreFabianus@gmx.de Web browser: --- Mobile Platform: ---
In the user-config a specific site is set but via 'pywikibot.getSite' or 'pywikibot.Site' another (unrelated) Site (family) is chosen.
But in fact after a few requests to the unrelated site it's also querying the user configured site. I found this when I was trying to figure out why I got warnings for a complete legit API call.
import pywikibot wp = pywikibot.getSite("en", "wikipedia") wp.tokens['edit']
https://en.wikipedia.org/w/api.php https://en.wikipedia.org/w/api.php https://en.wikipedia.org/w/api.php https://en.wikipedia.org/w/api.php https://en.wikipedia.org/w/api.php http://wiki.kerbalspaceprogram.com/w/api.php WARNING: API warning (query): Unrecognized value for parameter 'meta': tokens WARNING: API warning (main): Unrecognized parameter: 'type' Traceback (most recent call last): File "<stdin>", line 1, in <module> File "pywikibot/site.py", line 1200, in __getitem__ return storage[key] KeyError: 'csrf'
If I change the user configuration to the English Wikipedia all api.php calls vanish except one to en.wikipedia.org and I get a legit result.
Each URI is directly printed in the first line threadedhttp's Http.request method.
https://bugzilla.wikimedia.org/show_bug.cgi?id=70766
--- Comment #1 from Fabian CommodoreFabianus@gmx.de --- Okay a bit more output:
wikipedia:en /w/api.php maxlag=5&format=json&meta=siteinfo%7Cuserinfo&action=query&siprop=namespaces%7Cnamespacealiases%7Cgeneral&uiprop=blockinfo%7Chasmsg
wikipedia:en /w/api.php action=query&format=json&meta=userinfo&maxlag=5&uiprop=blockinfo%7Cgroups%7Chasmsg%7Crights
wikipedia:en /w/api.php action=query&format=json&meta=userinfo&maxlag=5&uiprop=blockinfo%7Cgroups%7Chasmsg%7Crights
wikipedia:en /w/api.php action=query&format=json&meta=userinfo&maxlag=5&uiprop=blockinfo%7Cgroups%7Chasmsg%7Crights
wikipedia:en /w/api.php maxlag=5&format=json&meta=siteinfo%7Cuserinfo&action=query&siprop=general&uiprop=blockinfo%7Chasmsg
ksp:en /w/api.php maxlag=5&format=json&meta=tokens%7Cuserinfo&action=query&type=csrf&uiprop=blockinfo%7Chasmsg
This is now directly above the assert in request of the http module. It prints the URI (always relative) the site (enwp except for the last) and the paramstring.
https://bugzilla.wikimedia.org/show_bug.cgi?id=70766
Mpaa mpaa.wiki@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mpaa.wiki@gmail.com
--- Comment #2 from Mpaa mpaa.wiki@gmail.com --- Tried to reproduce, no success so far.
https://bugzilla.wikimedia.org/show_bug.cgi?id=70766
--- Comment #3 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 159991 had a related patch set uploaded by XZise: [FIX] Tokens: Return the csrf token and request correct site
https://gerrit.wikimedia.org/r/159991
https://bugzilla.wikimedia.org/show_bug.cgi?id=70766
Gerrit Notification Bot gerritadmin@wikimedia.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |PATCH_TO_REVIEW
https://bugzilla.wikimedia.org/show_bug.cgi?id=70766
--- Comment #4 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 159991 merged by jenkins-bot: [FIX] Tokens: Return the csrf token and request correct site
https://gerrit.wikimedia.org/r/159991
https://bugzilla.wikimedia.org/show_bug.cgi?id=70766
Fabian CommodoreFabianus@gmx.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|PATCH_TO_REVIEW |RESOLVED Resolution|--- |FIXED
pywikipedia-bugs@lists.wikimedia.org