Skip to content
Snippets Groups Projects
Commit 2bb79128 authored by cariaso's avatar cariaso Committed by Dan Michael O. Heggø
Browse files

Cope with .ask() having more than 50 results

parent 9183e07c
No related branches found
No related tags found
No related merge requests found
...@@ -908,9 +908,19 @@ class Site(object): ...@@ -908,9 +908,19 @@ class Site(object):
Ask a query against Semantic MediaWiki. Ask a query against Semantic MediaWiki.
API doc: https://semantic-mediawiki.org/wiki/Ask_API API doc: https://semantic-mediawiki.org/wiki/Ask_API
Returns:
Generator for retrieving all search results
""" """
kwargs = {} kwargs = {}
if title is None: if title is None:
kwargs['title'] = title kwargs['title'] = title
result = self.raw_api('ask', query=query, **kwargs)
return result['query']['results'] offset = 0
while offset is not None:
results = self.raw_api('ask', query='{query}|offset={offset}'.format(
query=query, offset=offset), **kwargs)
offset = results.get('query-continue-offset')
for result in results['query']['results']:
yield result
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment