(self, url, headers=None, params=None)
return resp.json()
Generic request handler for OpenStack API requests
        Raises specialized Exceptions for commonly encountered error codes
Generic request handler for OpenStack API requests
        Raises specialized Exceptions for commonly encountered error codes
Generic request handler for OpenStack API requests Raises specialized Exceptions for commonly encountered error codes
def _make_request_with_auth_fallback(self, url, headers=None, params=None):
        """
        Generic request handler for OpenStack API requests
        Raises specialized Exceptions for commonly encountered error codes
        """
        self.log.debug("Request URL and Params: %s, %s", url, params)
        try:
            resp = requests.get(
                url,
                headers=headers,
                verify=self._ssl_verify,
                params=params,
                timeout=DEFAULT_API_REQUEST_TIMEOUT,
                proxies=self.proxy_config,
            )
            resp.raise_for_status()
        except requests.exceptions.HTTPError as e:
            self.log.debug("Error contacting openstack endpoint: %s", e)
            if resp.status_code == 401:
                self.log.info('Need to reauthenticate before next check')

                # Delete the scope, we'll populate a new one on the next run for this instance
                self.delete_current_scope()
            elif resp.status_code == 409:
                raise InstancePowerOffFailure()
            elif resp.status_code == 404:
                raise e
            else:
                raise

        return resp.json()
def _make_request_with_auth_fallback ( self , url , headers = None , params = None ) : self . log . debug ( "Request URL and Params: %s, %s" , url , params ) try : resp = requests . get ( url , headers = headers , verify = self . _ssl_verify , params = params , timeout = DEFAULT_API_REQUEST_TIMEOUT , proxies = self . proxy_config , ) resp . raise_for_status ( ) except requests . exceptions . HTTPError as e : self . log . debug ( "Error contacting openstack endpoint: %s" , e ) if resp . status_code == 401 : self . log . info ( 'Need to reauthenticate before next check' ) # Delete the scope, we'll populate a new one on the next run for this instance self . delete_current_scope ( ) elif resp . status_code == 409 : raise InstancePowerOffFailure ( ) elif resp . status_code == 404 : raise e else : raise return resp . json ( )