You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: support/entra/entra-id/users-groups-entra-apis/python-scripts-microsoft-graph-requests-detected-as-web-crawler.md
+18-4Lines changed: 18 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
---
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
3
3
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
5
5
ms.service: entra-id
6
6
ms.custom: sap:Problem with using the Graph SDK - libraries
7
7
ms.reviewer: daga, v-weizhu
8
8
---
9
9
# Python scripts making Microsoft Graph requests are detected as web crawlers
10
10
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.
12
12
13
13
## Symptoms
14
14
@@ -35,12 +35,26 @@ Here is an example of how you can structure your requests manually:
35
35
```python
36
36
from requests import Request, Session
37
37
38
-
defexample\_request(url):
38
+
defexample_request(url):
39
39
http = Session()
40
40
req = Request('GET', url, headers=h)
41
41
prepped = req.prepare()
42
42
resp = http.send(prepped)
43
43
return resp.json()
44
44
```
45
45
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
+
46
60
[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)]
0 commit comments