Skip to main content

python调用dubbo,目前支持dubbo协议,不需要服务端修改成jsonrpc.实现客户端的负载均衡、配合Zookeeper自动发现服务功能等

Project description

依赖pyhessian,bitstring

示例代码

from dubbo import DubboConsumer


def print_hi(consumer):
    req = consumer.queryCusStatis([("Lcom/weimob/o2o/wecom/data/api/interfaces/query/request/CusStatisRequest;",
                                    {"corpid": 1, "dateRangeType": 3})])
    print(f'req: {req!r}')
    for dto in req.responseVo.data.cusStatisDayDtos:
        print(f'dto: {dto!r}')


if __name__ == '__main__':
    consumer = DubboConsumer("10.11.32.251:2181", "com.weimob.o2o.wecom.data.api.interfaces.query.QueryCusApi")
    print_hi(consumer)

具体参照测main.py,目前支持常用的dubbo协议。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

duConsumer-0.0.4.tar.gz (1.8 kB view hashes)

Uploaded Source

Built Distribution

duConsumer-0.0.4-py3-none-any.whl (1.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page