code: def _get_pageids_for_category(category, limit=500, cmcontinue=None):
      """Returns a list of pageids for a specified category.
  
      See API docs: https://www.mediawiki.org/wiki/API:Categorymembers
  
      Args:
        category: Is the wikipedia category name as a string.
        limit: max number of pageids returned in response. Wikipedia by default
               limits us to 500.
        cmcontinue: continue hash used to request the next set of pages.
  
      Returns:
        List of pageids.
      """
      # Replace any whitespaces with underscores per wikipedia's URL patterns.
      category_url_param = "Category:%s" % str(category).replace(
          " ", "_"
      )
  
      # Set query params.
      payload = {
          "action": "query",
          "list": "categorymembers",
          "cmprop": "ids",
          "cmlimit": limit,
          "cmtype": "file",
          "cmtitle": category_url_param,
          "format": "json",
      }
      if cmcontinue is not None:
          payload["cmcontinue"] = cmcontinue
  
      r = requests.get(BASE_API_URL, params=payload)
      logging.debug("Connecting to url: %s" % r.url)
      response_data = r.json()
  
      try:
          cmcontinue = response_data["continue"]["cmcontinue"]
      except KeyError:
          # Reached the end!
          cmcontinue = None
  
      pages_list = response_data["query"]["categorymembers"]
      pageids = []
      for element in pages_list:
          pageids.append(element["pageid"])
      return pageids, cmcontinue
  
file_path: facets/facets_atlasmaker/utils/wikipedia_sourcelist_generator.py
imports: import csv
  import os
  from absl import app
  from absl import flags
  from absl import logging
  import requests
label_desc: Use image node_id 1 for calling a global function with example usage: _get_pageids_for_category(category, limit, cmcontinue) and returns: pageids,  cmcontinue