Skip to content

Commit 09d0cb6

Browse files
committed
Added page.skip_action(), skip restbase if non-wikipedia wiki #127
1 parent ac74247 commit 09d0cb6

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

wptools/page.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,14 @@ def _update_params(self):
472472
if self.data.get('wikibase'):
473473
self.params['wikibase'] = self.data.get('wikibase')
474474

475+
def skip_action(self, action):
476+
"""
477+
append action to skip flag
478+
"""
479+
if 'skip' not in self.flags:
480+
self.flags['skip'] = []
481+
self.flags['skip'].append(action)
482+
475483
def get(self, show=True, proxy=None, timeout=0):
476484
"""
477485
Make Mediawiki, RESTBase, and Wikidata requests for page data
@@ -506,14 +514,16 @@ def get(self, show=True, proxy=None, timeout=0):
506514
self.get_parse(False, proxy, timeout)
507515

508516
if not self.data.get('wikibase'):
509-
if 'skip' not in self.flags:
510-
self.flags['skip'] = []
511-
self.flags['skip'].append('wikidata')
517+
self.skip_action('wikidata')
512518

513519
self.get_wikidata(False, proxy, timeout)
514520

515521
self.flags['defer_imageinfo'] = False
516522

523+
wiki = self.params.get('wiki')
524+
if wiki and 'wikipedia.org' not in wiki:
525+
self.skip_action('restbase')
526+
517527
self.get_restbase('/page/summary/', False, proxy, timeout)
518528

519529
if show and not self.flags.get('silent'):

0 commit comments

Comments
 (0)