How to use dnacentersdk - 10 common examples

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 / tests / test_dnacentersdk.py View on Github external
def test_non_default_wait_on_rate_limit(self):
        connection_object = dnacentersdk.DNACenterAPI(username=DNA_CENTER_USERNAME,
                                                      password=DNA_CENTER_PASSWORD,
                                                      encoded_auth=DNA_CENTER_ENCODED_AUTH,
                                                      base_url=DEFAULT_BASE_URL,
                                                      wait_on_rate_limit=not DEFAULT_WAIT_ON_RATE_LIMIT,
                                                      verify=DEFAULT_VERIFY,
                                                      version=DNA_CENTER_VERSION)
        assert connection_object.wait_on_rate_limit != \
            DEFAULT_WAIT_ON_RATE_LIMIT
github cisco-en-programmability / dnacentersdk / tests / models / validators / v2_1_1 / jsd_f6b119ad4d4aaf16.py View on Github external
def validate(self, request):
        try:
            self._validator(request)
        except fastjsonschema.exceptions.JsonSchemaException as e:
            raise MalformedRequest(
                '{} is invalid. Reason: {}'.format(request, e.message)
            )
github cisco-en-programmability / dnacentersdk / tests / models / validators / v1_3_3 / jsd_cf9418234d9ab37e.py View on Github external
def validate(self, request):
        try:
            self._validator(request)
        except fastjsonschema.exceptions.JsonSchemaException as e:
            raise MalformedRequest(
                '{} is invalid. Reason: {}'.format(request, e.message)
            )
github cisco-en-programmability / dnacentersdk / tests / models / validators / v2_1_1 / jsd_c2a43ad24098baa7.py View on Github external
def validate(self, request):
        try:
            self._validator(request)
        except fastjsonschema.exceptions.JsonSchemaException as e:
            raise MalformedRequest(
                '{} is invalid. Reason: {}'.format(request, e.message)
            )
github cisco-en-programmability / dnacentersdk / tests / models / validators / v2_1_1 / jsd_45bc7a8344a8bc1e.py View on Github external
def validate(self, request):
        try:
            self._validator(request)
        except fastjsonschema.exceptions.JsonSchemaException as e:
            raise MalformedRequest(
                '{} is invalid. Reason: {}'.format(request, e.message)
            )
github cisco-en-programmability / dnacentersdk / tests / models / validators / v2_1_1 / jsd_cd98780f4888a66d.py View on Github external
def validate(self, request):
        try:
            self._validator(request)
        except fastjsonschema.exceptions.JsonSchemaException as e:
            raise MalformedRequest(
                '{} is invalid. Reason: {}'.format(request, e.message)
            )
github cisco-en-programmability / dnacentersdk / tests / api / __init__.py View on Github external
def api():
    return DNACenterAPI(username=DNA_CENTER_USERNAME,
                        password=DNA_CENTER_PASSWORD,
                        encoded_auth=DNA_CENTER_ENCODED_AUTH,
                        base_url=DEFAULT_BASE_URL,
                        single_request_timeout=DEFAULT_SINGLE_REQUEST_TIMEOUT,
                        wait_on_rate_limit=DEFAULT_WAIT_ON_RATE_LIMIT,
                        verify=DEFAULT_VERIFY,
                        version=DNA_CENTER_VERSION)
github cisco-en-programmability / dnacentersdk / tests / test_dnacentersdk.py View on Github external
def test_custom_base_url(self):
        custom_url = "https://custom.domain.com/v1/"
        with pytest.raises(dnacentersdk.exceptions.ApiError):
            dnacentersdk.DNACenterAPI(username=DNA_CENTER_USERNAME,
                                      password=DNA_CENTER_PASSWORD,
                                      encoded_auth=DNA_CENTER_ENCODED_AUTH,
                                      base_url=custom_url,
                                      verify=DEFAULT_VERIFY,
                                      version=DNA_CENTER_VERSION)
github cisco-en-programmability / dnacentersdk / tests / test_dnacentersdk.py View on Github external
def test_custom_single_request_timeout(self):
        custom_timeout = 10
        connection_object = dnacentersdk.DNACenterAPI(username=DNA_CENTER_USERNAME,
                                                      password=DNA_CENTER_PASSWORD,
                                                      encoded_auth=DNA_CENTER_ENCODED_AUTH,
                                                      base_url=DEFAULT_BASE_URL,
                                                      single_request_timeout=custom_timeout,
                                                      verify=DEFAULT_VERIFY,
                                                      version=DNA_CENTER_VERSION)
        assert connection_object.single_request_timeout == custom_timeout
github cisco-en-programmability / dnacentersdk / tests / test_dnacentersdk.py View on Github external
def test_custom_base_url(self):
        custom_url = "https://custom.domain.com/v1/"
        with pytest.raises(dnacentersdk.exceptions.ApiError):
            dnacentersdk.DNACenterAPI(username=DNA_CENTER_USERNAME,
                                      password=DNA_CENTER_PASSWORD,
                                      encoded_auth=DNA_CENTER_ENCODED_AUTH,
                                      base_url=custom_url,
                                      verify=DEFAULT_VERIFY,
                                      version=DNA_CENTER_VERSION)