From 153d9c64367d4dc68a27ae3e330a2de6f8d9c059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A6=83=E6=B5=88=E9=9C=93?= <2509165023@student.example.com> Date: Mon, 16 Mar 2026 22:39:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- my_requests.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 my_requests.py diff --git a/my_requests.py b/my_requests.py new file mode 100644 index 0000000..11f9957 --- /dev/null +++ b/my_requests.py @@ -0,0 +1,10 @@ +import requests +url = 'https://www.baidu.com' +params = {'key':'value'} +response = requests.grt(url,params=params) +if response.status_code == 200: + html_content = response.text + print("请求成功,获取到HTML内容") +else: + print(f"请求失败,状态码: {response.status_code}") + \ No newline at end of file