Skip to content

Commit 8c9bf68

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

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

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

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2-
title: Python scripts making Microsoft Graph requests are detected as web crawlers
2+
title: Python Scripts Making Microsoft Graph Requests are Detected as Web Crawlers
33
description: Provides solutions to an issue where Python Scripts might be detected as web-crawlers when making Microsoft Graph requests.
4-
ms.date: 04/17/2025
4+
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

@@ -35,12 +35,26 @@ Here is an example of how you can structure your requests manually:
3535
```python
3636
from requests import Request, Session
3737

38-
def example\_request(url):
38+
def example_request(url):
3939
http = Session()
4040
req = Request('GET', url, headers=h)
4141
prepped = req.prepare()
4242
resp = http.send(prepped)
4343
return resp.json()
4444
```
4545

46+
> [!NOTE]
47+
> - The `User-Agent` string in the HTTP request header should be unique to your application or script, differentiating it from generic traffic.
48+
> - 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.
50+
51+
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.
52+
53+
## More information
54+
55+
For more guidance on best practices when using Microsoft Graph, see the following articles:
56+
57+
- [Use the Microsoft Graph API](/graph/use-the-api)
58+
- [Throttling guidance for Microsoft Graph](/graph/throttling)
59+
4660
[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)]

0 commit comments

Comments
 (0)