python之requests
2021/6/13 20:21:16
本文主要是介绍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)#从内容中分析出的响应内容编码方式(备选编码方式)
这篇关于python之requests的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-08有遇到过吗?同样的规则 Excel 中 比Python 结果大
- 2024-03-30开始python成长之路
- 2024-03-29python optparse
- 2024-03-29python map 函数
- 2024-03-20invalid format specifier python
- 2024-03-18pool.map python
- 2024-03-18threads in python
- 2024-03-14python Ai 应用开发基础训练,字符串,字典,文件
- 2024-03-13id3 algorithm python
- 2024-03-13sum array elements python