From 5f495cd32f485209563f92bfc036783f2e3d2746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=A4=E4=BC=98?= <2509165039@student.example.com> Date: Sun, 15 Mar 2026 22:31:46 +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 | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 my_requests.py diff --git a/my_requests.py b/my_requests.py new file mode 100644 index 0000000..3449f52 --- /dev/null +++ b/my_requests.py @@ -0,0 +1,9 @@ +import requests +url='https://www.baidu.com' +params={'key':'value'} +response=requests.get(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