python写的http客户端测试程序
Python #http2012-11-23 00:03
直接上代码:
#httpclient.py import http.client with open("srv.file") as f: data = f.read() conn = http.client.HTTPConnection("192.168.59.128:8099") #注意encode函数,否则报错 http://yige.org conn.request("POST", "sys.service.release.func", data.encode('utf-8')) response = conn.getresponse() data = response.read() print(response.status, response.reason) print('res:', data.decode('utf-8')) conn.close()
相关文章
- 用python下载网页 2012/11/23
- 用Python来打印日历 2012/11/22
- Python实现115网盘自动摇奖 2012/11/22
- Python列表解析的方法 2012/11/21
- Python中全局变量的操作 2012/11/20
- Python实现二分查找 2012/11/20
- Python对文件批量随机重命名 2012/11/20
- Python做磁盘文件服务器 2012/11/20
- IIS7.0+Python环境搭建步骤 2012/11/19
- 在IIS中如何执行Python脚本 2012/11/19