Skip to content

Commit 6fee48a

Browse files
authored
Update python-scripts-microsoft-graph-requests-detected-as-web-crawler.md
1 parent 8c9bf68 commit 6fee48a

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

support/entra/entra-id/users-groups-entra-apis/python-scripts-microsoft-graph-requests-detected-as-web-crawler.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
2-
title: Python Scripts Making Microsoft Graph Requests are Detected as Web Crawlers
3-
description: Provides solutions to an issue where Python Scripts might be detected as web-crawlers when making Microsoft Graph requests.
2+
title: Python Scripts Making Microsoft Graph Requests Are Detected as Web Crawlers
3+
description: Provides solutions to an issue where Python Scripts might be detected as web crawlers when making Microsoft Graph requests.
44
ms.date: 04/21/2025
55
ms.service: entra-id
66
ms.custom: sap:Problem with using the Graph SDK - libraries
77
ms.reviewer: daga, v-weizhu
88
---
99
# Python scripts making Microsoft Graph requests are detected as web crawlers
1010

11-
This article provides solutions to an issue where Python scripts might be detected as web-crawlers when making Microsoft Graph requests.
11+
This article provides solutions to an issue where Python scripts might be detected as web crawlers when making Microsoft Graph requests.
1212

1313
## Symptoms
1414

15-
A Python script that makes a Microsoft Graph request might sometimes be detected by the gateway as web crawlers. If Python scripts use a pool manager, when you block the request, the following error message is returned:
15+
A Python script that makes a Microsoft Graph request might sometimes be detected by the gateway as web crawlers. If Python scripts use a pool manager, the following error message is returned when you block the request:
1616

1717
```output
1818
{'error': {'code': 'UnknownError', 'message': '\r\n403 Forbidden\r\n\r\n
@@ -24,13 +24,13 @@ Microsoft-Azure-Application-Gateway/v2
2424

2525
## Cause
2626

27-
The issue occurs because some Python scripts might not structure their requests in a way that conforms to expected patterns. As a result, the gateway mistakenly identifies the requests as coming from a web-crawler.
27+
The issue occurs because some Python scripts might not structure their requests in a way that conforms to the expected patterns. As a result, the gateway mistakenly identifies the requests as coming from a web crawler.
2828

2929
## Solution
3030

3131
To resolve this issue, use the [Microsoft Graph SDK for Python](https://github.com/microsoftgraph/msgraph-sdk-python-core). If you don't want to use it, structure your requests similarly to how the SDK handles them by using Python's Session object to send requests.
3232

33-
Here is an example of how you can structure your requests manually:
33+
Here's an example of how you can structure your requests manually:
3434

3535
```python
3636
from requests import Request, Session
@@ -46,7 +46,7 @@ def example_request(url):
4646
> [!NOTE]
4747
> - The `User-Agent` string in the HTTP request header should be unique to your application or script, differentiating it from generic traffic.
4848
> - Including additional headers such as `Accept: application/json` can help clarify the intent of your request.
49-
> - Incorrectly identifying as crawler traffic might result in throttling or other automated mitigations by Microsoft's backend systems. Properly identifying your client helps avoid these issues.
49+
> - Incorrectly identified as crawler traffic might result in throttling or other automated mitigations by Microsoft's backend systems. Properly identifying your client helps avoid these issues.
5050
5151
If you use a different HTTP client, ensure that similar headers are set appropriately. Refer to your HTTP client's documentation for customizing request headers.
5252

@@ -55,6 +55,6 @@ If you use a different HTTP client, ensure that similar headers are set appropri
5555
For more guidance on best practices when using Microsoft Graph, see the following articles:
5656

5757
- [Use the Microsoft Graph API](/graph/use-the-api)
58-
- [Throttling guidance for Microsoft Graph](/graph/throttling)
58+
- [Microsoft Graph throttling guidance](/graph/throttling)
5959

6060
[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)]

0 commit comments

Comments
 (0)