向网页发出请求,并打印响应文本:
import requests
x = requests.get('https://91xjr.com/python/demopage.htm')
print(x.text)
运行示例 »
这个requests
模块允许您使用 Python 发送 HTTP 请求。
HTTP 请求返回一个响应对象包含所有响应数据(内容、编码、状态等)。
将命令行导航到 PIP 的位置,然后键入以下内容:
C:\Users\
Your Name\AppData\Local\Programs\Python\Python36-32\Scripts>pip install requests
requests.
methodname(params)
Method | Description |
---|---|
delete(url, args) | Sends a DELETE request to the specified url |
get(url, params, args) | Sends a GET request to the specified url |
head(url, args) | Sends a HEAD request to the specified url |
patch(url, data, args) | Sends a PATCH request to the specified url |
post(url, data, json, args) | Sends a POST request to the specified url |
put(url, data, args) | Sends a PUT request to the specified url |
request(method, url, args) | Sends a request of the specified method to the specified url |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!