Python之requests

import requests
url='http://192.168.3.4/php/executeCommand.php'#请求url
update_data={'jsondata[shell]': 'upgrade.sh','jsondata[command]': 'system'}#请求体
res=requests.post(url,update_data)
print(res.text)#http响应内容的字符串形式,即返回的页面内容
print(res.json())#http响应的json格式
print(res.status_code)#http请求的返回状态,若为200则表示请求成功
print(res.encoding)#从http header 中猜测的相应内容编码方式
print(res.content)#http响应内容的二进制形式
print(res.apparent_encoding)#从内容中分析出的响应内容编码方式(备选编码方式)
原文地址:https://www.cnblogs.com/1527275083gj/p/14880906.html