code: def load_media(self, max_pages=150):
          logger.info("loading media")
          if self.purge_first:
              logger.warning("purging ALL media from site %s", self.site_id)
              Media.objects.filter(site_id=self.site_id).delete()
          path = "sites/{}/media".format(self.site_id)
          params = {"number": 100}
          self.set_media_params_after(params)
          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_medias = response.json().get("media")
              if not api_medias:
                  break
              medias = []
              for api_media in api_medias:
                  if api_media["post_ID"] != 0:
                      existing_media = Media.objects.filter(site_id=self.site_id, wp_id=api_media["ID"]).first()
                      if existing_media:
                          self.update_existing_media(existing_media, api_media)
                      else:
                          medias.append(self.get_new_media(api_media))
              if medias:
                  Media.objects.bulk_create(medias)
              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