code: def load_categories(self, max_pages=30):
          
          logger.info("loading categories")
  
          # clear them all out so we don't get dupes if requested
          if self.purge_first:
              Category.objects.filter(site_id=self.site_id).delete()
  
          path = "sites/{}/categories".format(self.site_id)
          params = {"number": 100}
          page = 1
  
          response = self.get(path, params)
  
          if not response.ok:
              logger.warning("Response NOT OK! status_code=%s\n%s", response.status_code, response.text)
  
          while response.ok and response.text and page < max_pages:
              logger.info(" - page: %d", page)
  
              api_categories = response.json().get("categories")
              if not api_categories:
                  # we're done here
                  break
  
              categories = []
              for api_category in api_categories:
  
                  # if it exists locally, update local version if anything has changed
                  existing_category = Category.objects.filter(site_id=self.site_id, wp_id=api_category["ID"]).first()
                  if existing_category:
                      self.update_existing_category(existing_category, api_category)
                  else:
                      categories.append(self.get_new_category(api_category))
  
              if categories:
                  Category.objects.bulk_create(categories)
              elif not self.full:
                  # we're done here
                  break
  
              # get next page
              page += 1
              params["page"] = page
              response = self.get(path, params)
  
              if not response.ok:
                  logger.warning("Response NOT OK! status_code=%s\n%s", response.status_code, response.text)
                  return
docs: Load all WordPress categories from the given site.
  
          :param max_pages: kill counter to avoid infinite looping
          :return: None