

def _refresh(self, http_request):
    'Refreshes the access_token.\n\n        Skip all the storage hoops and just refresh using the API.\n\n        Args:\n            http_request: callable, a callable that matches the method\n                          signature of httplib2.Http.request, used to make\n                          the refresh request.\n\n        Raises:\n            HttpAccessTokenRefreshError: When the refresh fails.\n        '
    (response, content) = http_request(META, headers={
        'Metadata-Flavor': 'Google',
    })
    content = _from_bytes(content)
    if (response.status == http_client.OK):
        try:
            token_content = json.loads(content)
        except Exception as e:
            raise HttpAccessTokenRefreshError(str(e), status=response.status)
        self.access_token = token_content['access_token']
    else:
        if (response.status == http_client.NOT_FOUND):
            content += ' This can occur if a VM was created with no service account or scopes.'
        raise HttpAccessTokenRefreshError(content, status=response.status)

dataset/ETHPy150Open google/oauth2client/oauth2client/contrib/gce.py AppAssertionCredentials._refresh/original