From cc1bc17931bc87e744628da0adece9bf1f7046d1 Mon Sep 17 00:00:00 2001 From: 2509165005 <2509165005@student.edu.cn> Date: Mon, 16 Mar 2026 22:13:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 蠕虫·.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 蠕虫·.py diff --git a/蠕虫·.py b/蠕虫·.py new file mode 100644 index 0000000..d29f76f --- /dev/null +++ b/蠕虫·.py @@ -0,0 +1,26 @@ +import requests + +# 发送GET请求 +response = requests.get('https://example.com') + +# 查看响应状态码 +print(response.status_code) # 200 + +# 查看响应内容(文本) +print(response.text) + +# 查看响应内容(JSON) +print(response.json()) + +# 查看响应头 +print(response.headers) + +import requests +url = 'https: //example.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