`
youanyyou
  • 浏览: 191888 次
  • 性别: Icon_minigender_1
  • 来自: 长沙
社区版块
存档分类
最新评论

Python3调用hessian

阅读更多

领导派了个任务,实现服务器日志文件调用hessian接口保存到数据库

研究了半天python调用hessian的办法

 

首先使用hessian for python的链接:

http://hessian.caucho.com/#Python

引入进来后各种报错,各种崩溃啊

hessianlib.py在官网上还是2007的版本,估计不支持python3??

 

然后寻找python3调用hessian的资料,关于python2转换成3的语法,使用:

2to3.py在python目录:C:\Python\Tools\Scripts\2to3.py

python 2to3.py -w hessianlib.py

运行后,转换部分不成功,后来还是放弃了这个想法

 

后来上谷歌一直寻找方案,最终在不断地研究下找到了突破口,原来关于hessian的python实现,已经转交给mustaine项目来处理,并且给出了google code地址:http://code.google.com/p/mustaine/

接下来安装pyhessian和six

pyhessian下载:http://code.google.com/p/mustaine/

six下载:https://pypi.python.org/pypi/six

下载后使用命令安装:

python C:\Users\Admin\Desktop\python-hessian-master\setup.py install

python C:\Users\Admin\Desktop\six-1.9.0\setup.py install

安装后six没问题了,可pyhessian还需要把目录python-hessian-master\pyhessian复制到C:\Python\Lib\site-packages\pyhessian

 

引用pyhessian:

from pyhessian.client import HessianProxy

 

测试pyhessian成功:

params = {"p1":"101", "p2":"102"}

service = HessianProxy("http://192.168.1.1:8080/test/services/test.hessian")

result = service.test(params)

print(result.value)

 

2
2
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics