Azure / Azure/azure-sdk-for-python

`polling_interval` kwarg in DocumentIntelligenceClient.begin_analyze_document` is not being respected

Open
#43,114 1 comment 0 reactions 1 assignee Claimed by @yungshinlintw View on GitHub
Client customer-reported Document Intelligence needs-team-attention question
Dominant language
Python
Stars
5.6k
Forks
3.4k
Avg merge
1d 21h
Merged PRs (30d)
193

Description

- **Package Name**: azure-ai-documentintelligence
- **Package Version**: 1.0.2
- **Operating System**: MacOS Sequoia 15.7
- **Python Version**: 3.13.1

**Describe the bug**
the `polling_interval` kwarg in `DocumentIntelligenceClient.begin_analyze_document` is not being respected

**To Reproduce**
Steps to reproduce the behavior:
1. run the following snippet

```python
from io import BytesIO

from azure.ai.documentintelligence import DocumentIntelligenceClient
from azure.core.exceptions import HttpResponseError
from azure.core.polling import LROPoller

def run_ocr(pdf_bytes: bytes, client: DocumentIntelligenceClient) -> None
poller: LROPoller = client.begin_analyze_document(
model_id='prebuilt-read',
body=BytesIO(pdf_bytes),
content_type='application/pdf',
output=['pdf'],
polling_interval=10,
)

result = poller.result(timeout=timeout)
if poller.status() != 'succeeded':
raise Exception(f'Document intelligence failed with status {poller.status()}')
```

**Expected behavior**
The poller should run every 10 seconds -- instead it polls every second. see the following stream of requests which was logged (note `retry-after` is always 1)

```
Request headers:
'x-ms-client-request-id': 'adfbd91c-992a-11f0-a7a4-46532a3ca5f1'
'User-Agent': 'azsdk-python-ai-documentintelligence/1.0.2 Python/3.10.15 (macOS-15.7-arm64-arm-64bit)'
'Authorization': 'REDACTED'
No body was attached to the request

INFO:azure.core.pipeline.policies.http_logging_policy:Response status: 200
Response headers:
'Content-Length': '106'
'Content-Type': 'application/json; charset=utf-8'
'retry-after': '1'
'x-envoy-upstream-service-time': 'REDACTED'
'apim-request-id': 'REDACTED'
'Strict-Transport-Security': 'REDACTED'
'x-content-type-options': 'REDACTED'
'x-ms-region': 'REDACTED'
'Date': 'Wed, 24 Sep 2025 09:42:14 GMT'

INFO:azure.core.pipeline.policies.http_logging_policy:Request URL: 'https://DOMAIN.cognitiveservices.azure.com/documentintelligence/documentModels/prebuilt-read/analyzeResults/8fd23bd0-5b6c-4573-8f69-099a0aa89a24?api-version=REDACTED'
Request method: 'GET'
Request headers:
'x-ms-client-request-id': 'adfbd91c-992a-11f0-a7a4-46532a3ca5f1'
'User-Agent': 'azsdk-python-ai-documentintelligence/1.0.2 Python/3.10.15 (macOS-15.7-arm64-arm-64bit)'
'Authorization': 'REDACTED'
No body was attached to the request

INFO:azure.core.pipeline.policies.http_logging_policy:Response status: 200
Response headers:
'Content-Length': '106'
'Content-Type': 'application/json; charset=utf-8'
'retry-after': '1'
'x-envoy-upstream-service-time': 'REDACTED'
'apim-request-id': 'REDACTED'
'Strict-Transport-Security': 'REDACTED'
'x-content-type-options': 'REDACTED'
'x-ms-region': 'REDACTED'
'Date': 'Wed, 24 Sep 2025 09:42:15 GMT'

INFO:azure.core.pipeline.policies.http_logging_policy:Request URL: 'https://DOMAIN.cognitiveservices.azure.com/documentintelligence/documentModels/prebuilt-read/analyzeResults/8fd23bd0-5b6c-4573-8f69-099a0aa89a24?api-version=REDACTED'
Request method: 'GET'
Request headers:
'x-ms-client-request-id': 'adfbd91c-992a-11f0-a7a4-46532a3ca5f1'
'User-Agent': 'azsdk-python-ai-documentintelligence/1.0.2 Python/3.10.15 (macOS-15.7-arm64-arm-64bit)'
'Authorization': 'REDACTED'
No body was attached to the request

INFO:azure.core.pipeline.policies.http_logging_policy:Response status: 200
Response headers:
'Content-Length': '106'
'Content-Type': 'application/json; charset=utf-8'
'retry-after': '1'
'x-envoy-upstream-service-time': 'REDACTED'
'apim-request-id': 'REDACTED'
'Strict-Transport-Security': 'REDACTED'
'x-content-type-options': 'REDACTED'
'x-ms-region': 'REDACTED'
'Date': 'Wed, 24 Sep 2025 09:42:16 GMT'
```

**Screenshots**
--

**Additional context**
--

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.