https://bugzilla.wikimedia.org/show_bug.cgi?id=66256
Bug ID: 66256 Summary: Category.articles() total parameter must not be None 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: info@gno.de Web browser: --- Mobile Platform: ---
If total parameter is None, the generator sometimes does not yield any pages but gives an 503 status error:
import pwb import pywikibot as py s = py.Site('commons', 'commons') c = py.Category(s, 'Korea.net_photos_to_check') for p in c.articles(total=10, content=False, recurse=False, step=None):
print p.title()
File:Kim Yu-na G20 Seoul Summit Ambassador.jpg File:KOCIS 150m-long kimbap (5911816764).jpg File:KOCIS 150m-long kimbap (5911817226).jpg File:KOCIS 2010 UNESCO World Conference of Arts Education (4640759629).jpg File:KOCIS 2010 UNESCO World Conference of Arts Education (4641367198).jpg File:KOCIS 2010 UNESCO World Conference of Arts Education (4641367274).jpg File:KOCIS 2010 UNESCO World Conference of Arts Education (4641367322).jpg File:KOCIS 2012 Yeosu Expo (7548642068).jpg File:KOCIS 2012 Yeosu Expo (7548642206).jpg File:KOCIS 38th Annual Los Angeles Korean Festival (6301325981).jpg
whereas total=None fails into 503 loop
for p in c.articles(total=None, content=False, recurse=False, step=None):
print p.title()
WARNING: Http response status 503 WARNING: Non-JSON response received from server commons:commons; the server may be down. Set gcmlimit = 2500 WARNING: Waiting 5 seconds before retrying.
Traceback (most recent call last): File "<pyshell#20>", line 1, in <module> for p in c.articles(total=None, content=False, recurse=False, step=None): File "pywikibot\page.py", line 1909, in articles endsort=endsort File "pywikibot\data\api.py", line 719, in __iter__ self.data = self.request.submit() File "pywikibot\data\api.py", line 306, in submit body=paramstring) File "pywikibot\comms\http.py", line 144, in request time.sleep(0.1) KeyboardInterrupt
https://bugzilla.wikimedia.org/show_bug.cgi?id=66256
xqt info@gno.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Priority|Unprioritized |Normal CC| |steinsplitter@wikipedia.de Assignee|Pywikipedia-bugs@lists.wiki |info@gno.de |media.org | Severity|normal |major
pywikipedia-bugs@lists.wikimedia.org