9 lines
370 B
Python
9 lines
370 B
Python
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)") |