def verify_and_sync_pages(self):
        # Get the Server Key for PyPI
        if self.datastore.get(SERVERKEY_KEY):
            key = load_key(self.datastore.get(SERVERKEY_KEY))
        else:
            serverkey = requests.get(SERVERKEY_URL, prefetch=True)
            key = load_key(serverkey.content)
            self.datastore.set(SERVERKEY_KEY, serverkey.content)

        try:
            # Download the "simple" page from PyPI for this package
            simple = requests.get(urlparse.urljoin(SIMPLE_URL, urllib.quote(self.name)), prefetch=True)
            simple.raise_for_status()
        except requests.HTTPError:
            if simple.status_code == 404:
                return {"has_sig": False}
            raise

        try:
            # Download the "serversig" page from PyPI for this package
            serversig = requests.get(urlparse.urljoin(SERVERSIG_URL, urllib.quote(self.name)), prefetch=True)
            serversig.raise_for_status()
        except requests.HTTPError:
            if serversig.status_code == 404:
                return {"has_sig": False}
            raise

        try:
            if not verify(key, simple.content, serversig.content):
                raise Exception("Simple API page does not match serversig")  # @@@ This Should be Custom Exception
        except (__HOLE__, UnicodeEncodeError, ValueError):
            logger.exception("Exception trying to verify %s" % self.name)  # @@@ Figure out a better way to handle this

        try:
            package = Package.objects.get(name=self.name)
        except Package.DoesNotExist:
            logger.exception("Error Trying To Verify %s (Querying Package)" % self.name)
            return

        simple_mirror, c = PyPIMirrorPage.objects.get_or_create(package=package, defaults={"content": simple.content})
        if not c and simple_mirror.content != simple.content:
            simple_mirror.content = simple.content
            simple_mirror.save()

        serversig_mirror, c = PyPIServerSigPage.objects.get_or_create(package=package, defaults={"content": serversig.content.encode("base64")})
        serversig_mirror.content = base64.b64encode(serversig.content)
        serversig_mirror.save()

        return {
            "simple": simple.content,
            "serversig": serversig.content,
            "has_sig": True,
        }
dataset/ETHPy150Open crate-archive/crate-site/crateweb/apps/pypi/processor.py/PyPIPackage.verify_and_sync_pages