From d565afd42d8bae31e028e9b6b493004f44bc5394 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Jul 2026 17:31:26 +0000 Subject: [PATCH] Fix Wikipedia request user agent --- 1-Introduction/01-defining-data-science/notebook.ipynb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/1-Introduction/01-defining-data-science/notebook.ipynb b/1-Introduction/01-defining-data-science/notebook.ipynb index 0e9199fc..fb503a19 100644 --- a/1-Introduction/01-defining-data-science/notebook.ipynb +++ b/1-Introduction/01-defining-data-science/notebook.ipynb @@ -44,7 +44,12 @@ "source": [ "import requests\r\n", "\r\n", - "text = requests.get(url).content.decode('utf-8')\r\n", + "headers = {\r\n", + " 'User-Agent': 'DataScienceForBeginners/1.0 (https://github.com/microsoft/Data-Science-For-Beginners)'\r\n", + "}\r\n", + "response = requests.get(url, headers=headers)\r\n", + "response.raise_for_status()\r\n", + "text = response.content.decode('utf-8')\r\n", "print(text[:1000])" ], "outputs": [