Files
2026-03-24 21:11:35 +08:00

9 lines
370 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import requests
url = 'https://example.com'
params ={'key':'value')# 查询参数#发送GET 请求并带上查询参数
response = requests.get (url, params=params)#检查请求是否成功
if response.status code ==200:
html content = response.text
print("请求成功获取到HTML内容")
else:
print(f"请求失败,状态码:{response.status code)")