parameters: (self, http_request)
docstring: Refresh the access_token using the refresh_token.
  
      Args:
        http_request: callable, a callable that matches the method signature of
          httplib2.Http.request, used to make the refresh request.
  
      Raises:
        AccessTokenRefreshError: When the refresh fails.
docstring_summary: Refresh the access_token using the refresh_token.
docstring_tokens: Refresh the access_token using the refresh_token .
function: def _do_refresh_request(self, http_request):
      """Refresh the access_token using the refresh_token.
  
      Args:
        http_request: callable, a callable that matches the method signature of
          httplib2.Http.request, used to make the refresh request.
  
      Raises:
        AccessTokenRefreshError: When the refresh fails.
      """
      body = self._generate_refresh_request_body()
      headers = self._generate_refresh_request_headers()
  
      logger.info('Refreshing access_token')
      resp, content = http_request(
          self.token_uri, method='POST', body=body, headers=headers)
      if resp.status == 200:
        # TODO(jcgregorio) Raise an error if loads fails?
        d = simplejson.loads(content)
        self.token_response = d
        self.access_token = d['access_token']
        self.refresh_token = d.get('refresh_token', self.refresh_token)
        if 'expires_in' in d:
          self.token_expiry = datetime.timedelta(
              seconds=int(d['expires_in'])) + datetime.datetime.utcnow()
        else:
          self.token_expiry = None
        if self.store:
          self.store.locked_put(self)
      else:
        # An {'error':...} response body means the token is expired or revoked,
        # so we flag the credentials as such.
        logger.info('Failed to retrieve access token: %s' % content)
        error_msg = 'Invalid response %s.' % resp['status']
        try:
          d = simplejson.loads(content)
          if 'error' in d:
            error_msg = d['error']
            self.invalid = True
            if self.store:
              self.store.locked_put(self)
        except StandardError:
          pass
        raise AccessTokenRefreshError(error_msg)
function_tokens: def _do_refresh_request ( self , http_request ) : body = self . _generate_refresh_request_body ( ) headers = self . _generate_refresh_request_headers ( ) logger . info ( 'Refreshing access_token' ) resp , content = http_request ( self . token_uri , method = 'POST' , body = body , headers = headers ) if resp . status == 200 : # TODO(jcgregorio) Raise an error if loads fails? d = simplejson . loads ( content ) self . token_response = d self . access_token = d [ 'access_token' ] self . refresh_token = d . get ( 'refresh_token' , self . refresh_token ) if 'expires_in' in d : self . token_expiry = datetime . timedelta ( seconds = int ( d [ 'expires_in' ] ) ) + datetime . datetime . utcnow ( ) else : self . token_expiry = None if self . store : self . store . locked_put ( self ) else : # An {'error':...} response body means the token is expired or revoked, # so we flag the credentials as such. logger . info ( 'Failed to retrieve access token: %s' % content ) error_msg = 'Invalid response %s.' % resp [ 'status' ] try : d = simplejson . loads ( content ) if 'error' in d : error_msg = d [ 'error' ] self . invalid = True if self . store : self . store . locked_put ( self ) except StandardError : pass raise AccessTokenRefreshError ( error_msg )