python写的http客户端测试程序
Python #http2012-11-23 00:03
直接上代码:
01 | #httpclient.py |
02 |
03 | import http.client |
04 | with open ( "srv.file" ) as f: |
05 | data = f.read() |
06 | conn = http.client.HTTPConnection( "192.168.59.128:8099" ) |
07 | #注意encode函数,否则报错 http://yige.org |
08 | conn.request( "POST" , "sys.service.release.func" , data.encode( 'utf-8' )) |
09 | response = conn.getresponse() |
10 | data = response.read() |
11 | print (response.status, response.reason) |
12 | print ( 'res:' , data.decode( 'utf-8' )) |
13 | 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