How to use the dnacentersdk.utils.pprint_response_info function in dnacentersdk

To help you get started, we’ve selected a few dnacentersdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cisco-en-programmability / dnacentersdk / dnacentersdk / restsession.py View on Github external
try:
                # Check the response code for error conditions
                check_response_code(response, erc)
            except RateLimitError as e:
                # Catch rate-limit errors
                # Wait and retry if automatic rate-limit handling is enabled
                if self.wait_on_rate_limit:
                    warnings.warn(RateLimitWarning(response))
                    time.sleep(e.retry_after)
                    continue
                else:
                    # Re-raise the RateLimitError
                    raise
            except ApiError as e:
                if e.status_code == 401 and custom_refresh < 1:
                    logger.debug(pprint_response_info(response))
                    logger.debug('Refreshing access token')
                    self.refresh_token()
                    logger.debug('Refreshed token.')
                    return self.request(method, url, erc, 1, **kwargs)
                else:
                    # Re-raise the ApiError
                    logger.debug(pprint_response_info(response))
                    raise
            else:
                logger.debug(pprint_response_info(response))
                return response
github cisco-en-programmability / dnacentersdk / dnacentersdk / api / custom_caller.py View on Github external
headers,
                                         **kwargs))
        response = self._session._req_session.request(method,
                                                      abs_url,
                                                      headers=headers,
                                                      verify=verify,
                                                      **kwargs)

        if raise_exception:
            try:
                response.raise_for_status()
            except HTTPError as e:
                logger.debug(pprint_response_info(e.response))
                raise e

        logger.debug(pprint_response_info(response))
        if original_response:
            return response
        else:
            json_data = extract_and_parse_json(response)
            return self._object_factory('bpm_custom', json_data)
github cisco-en-programmability / dnacentersdk / dnacentersdk / restsession.py View on Github external
else:
                    # Re-raise the RateLimitError
                    raise
            except ApiError as e:
                if e.status_code == 401 and custom_refresh < 1:
                    logger.debug(pprint_response_info(response))
                    logger.debug('Refreshing access token')
                    self.refresh_token()
                    logger.debug('Refreshed token.')
                    return self.request(method, url, erc, 1, **kwargs)
                else:
                    # Re-raise the ApiError
                    logger.debug(pprint_response_info(response))
                    raise
            else:
                logger.debug(pprint_response_info(response))
                return response
github cisco-en-programmability / dnacentersdk / dnacentersdk / api / custom_caller.py View on Github external
verify = kwargs.pop("verify", self._session.verify)

        logger.debug(pprint_request_info(abs_url, method,
                                         headers,
                                         **kwargs))
        response = self._session._req_session.request(method,
                                                      abs_url,
                                                      headers=headers,
                                                      verify=verify,
                                                      **kwargs)

        if raise_exception:
            try:
                response.raise_for_status()
            except HTTPError as e:
                logger.debug(pprint_response_info(e.response))
                raise e

        logger.debug(pprint_response_info(response))
        if original_response:
            return response
        else:
            json_data = extract_and_parse_json(response)
            return self._object_factory('bpm_custom', json_data)