diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/retry.py b/sdk/core/azure-core/azure/core/pipeline/policies/retry.py index 0a9f4da6d0b..fbed38de7fe 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/retry.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/retry.py @@ -105,7 +105,7 @@ def __init__(self, **kwargs): def no_retries(cls): """Disable retries. """ - return cls(retry_count_total=0) + return cls(retry_total=0) def configure_retries(self, options): """Configures the retry settings. diff --git a/sdk/core/azure-core/examples/examples_sync.py b/sdk/core/azure-core/examples/examples_sync.py index d935935411f..971500e6880 100644 --- a/sdk/core/azure-core/examples/examples_sync.py +++ b/sdk/core/azure-core/examples/examples_sync.py @@ -151,3 +151,17 @@ def test_example_retry_policy(): response = pipeline_response.http_response assert response.status_code == 200 + +def test_example_no_retries(): + url = "https://bing.com" + + config = Configuration() + config.retry_policy = RetryPolicy.no_retries() + + client = PipelineClient(base_url=url, config=config) + request = client.get(url) + pipeline_response = client._pipeline.run(request) + + response = pipeline_response.http_response + # bing returns 301 if not retried + assert response.status_code == 301