'Get the latest PyPI version (as a string) via the RESTful JSON API'

def _update_pypi_version(self):

    logger.debug('Get    latest    Glances    version    from    the    PyPI    RESTful    API    ({})'.format(PYPI_API_URL))
    self.data[u'refresh_date'] = datetime.now()
    try:
        res = urlopen(PYPI_API_URL, timeout=3).read()
    except (HTTPError, URLError) as e:
        logger.debug('Cannot    get    Glances    version    from    the    PyPI    RESTful    API    ({})'.format(e))
    else:
        self.data[u'latest_version'] = json.loads(nativestr(res))['info']['version']
        logger.debug('Save    Glances    version    to    the    cache    file')
    self._save_cache()
    return self.data
