Exemplo n.º 1
0
 def _get_json(self):
     response = urllib.urlopen(self.json_url)
     if response.getcode() != 200:
         raise PyPiNotFound('%s not on pypi', self.name)
     data = response.read()
     text = data.decode('utf-8')
     return json.loads(text)
Exemplo n.º 2
0
 def _get_json(self):
     response = urllib.urlopen(self.json_url)
     if response.getcode() != 200:
         log.error('not found: %s', self.json_url)
         raise PyPiNotFound('%s not on pypi', self.name)
     data = response.read()
     text = data.decode('utf-8')
     return json.loads(text)
Exemplo n.º 3
0
 def _refresh(self):
     """
     Download and rank the mirror list.
     """
     log.info('Downloading the Sage mirror list')
     try:
         with contextlib.closing(urllib.urlopen(self.URL)) as f:
             mirror_list = f.read().decode("ascii")
     except IOError:
         log.critical('Downloading the mirror list failed, using cached version')
     else:
         self.mirrors = self._load(mirror_list)
         self._rank_mirrors()
         self._save()
Exemplo n.º 4
0
 def _refresh(self):
     """
     Download and rank the mirror list.
     """
     log.info('Downloading the Sage mirror list')
     try:
         with contextlib.closing(urllib.urlopen(self.URL)) as f:
             mirror_list = f.read().decode("ascii")
     except IOError:
         log.critical('Downloading the mirror list failed')
     else:
         self.mirrors = self._load(mirror_list)
         self._rank_mirrors()
         self._save()
Exemplo n.º 5
0
 def __init__(self):
     self.filename = os.path.join(SAGE_DISTFILES, 'mirror_list')
     if self.must_refresh():
         log.info('Downloading the Sage mirror list')
         try:
             with contextlib.closing(urllib.urlopen(self.URL)) as f:
                 mirror_list = f.read().decode("ascii")
         except IOError:
             log.critical('Downloading the mirror list failed')
             self.mirrors = self._load()
         else:
             self.mirrors = self._load(mirror_list)
             self._rank_mirrors()
             self._save()
     else:
         self.mirrors = self._load()