def __continued_query(self, query_params):
    query_params.update(self.__title_query_param)

    last_continue = {}
    prop = query_params.get('prop', None)

    while True:
      params = query_params.copy()
      params.update(last_continue)

      request = _wiki_request(params)

      if 'query' not in request:
        break

      pages = request['query']['pages']
      if 'generator' in query_params:
        for datum in pages.values():  # in python 3.3+: "yield from pages.values()"
          yield datum
      else:
        for datum in pages[self.pageid][prop]:
          yield datum

      if 'continue' not in request:
        break

      last_continue = request['continue']
Based on https://www.mediawiki.org/wiki/API:Query#Continuing_queries
dataset/ETHPy150Open goldsmith/Wikipedia/wikipedia/wikipedia.py/WikipediaPage.__continued_query