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)
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)
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()
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()
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()