hessian的python客户端2

Hessian官方自带的python客户端有问题,代码只写了一半,没有__write()方法定义。运行出错: AttributeError: HessianWriter instance has no attribute '_HessianWriter__write 源文件:http://t.cn/zWlGjuY


后来google了一下才发现新的代码在这里: http://github.com/bgilmore/mustaine
下载下来之后看了一下code行数,还行:
mustaine/*.py
  115 mustaine/client.py
  189 mustaine/encoder.py
   32 mustaine/__init__.py
  272 mustaine/parser.py
  152 mustaine/protocol.py
   43 mustaine/_util.py
  803 总用量

用法
  from mustaine.client import HessianProxy
  test = HessianProxy("http://localhost:8080/Hello")
   print test.hello({"type":"python2"})

输出 hello,python2

package test;

import java.util.Map;

public class BasicService implements BasicAPI{

	public String hello(Map param) {
		return "Hello, "+param.get("type");
	}

}


猜你喜欢

转载自san-yun.iteye.com/blog/1628405
今日推荐