python调用dubbo,目前支持dubbo协议,不需要服务端修改成jsonrpc.实现客户端的负载均衡、配合Zookeeper自动发现服务功能等 依赖pyhessian,bitstring
示例代码
from pydubbo.pydubbo import DubboZK
if __name__ == '__main__':
d = DubboZK(interface="com.dianwoba.genius.provider.StaffProvider", hosts='192.168.11.29:2185')
res = d.findByCode([("Ljava/lang/String;", u"00064")]) #根据返回的方法,动态添加.输入的参数只有一个java string类型
print(res, res.data)#(<com.dianwoba.dubbo.base.result.ResponseDTO object at 0x1035d2a50>, <com.dianwoba.genius.domain.dto.StaffDTO object at 0x1035d2ad0>)
res = d.findByMobile([("Ljava/lang/String;", u"18657112153")]) #根据返回的方法,动态添加.输入的参数只有一个java string类型
print(res.data.name)
具体参照测test目录,目前支持常用的dubbo协议。
1.dubbo协议
1.1 请求头
intbe:16=-9541,intbe:8=-62,intbe:8=0,uintbe:64=0,uintbe:32=数据包长度
总长度16字节。
依次是2字节的magic信息 ,一个字节的附加信息 ,一个字节的空信息,8个字节的空信息,4个字节的数据包长度
1.2 信息体
通过hessian协议序列化的二进制信息
1.3 响应头
intbe:16,intbe:8,intbe:8,uintbe:64,uintbe:32
总长度16个字节
依次是2字节的magic信息 ,一个字节的附加信息 ,一个字节的空信息,8个字节的空信息,4个字节的数据包长度
Metadata
Release files for pydubbo 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pydubbo-0.1.1.tar.gz | 10.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydubbo-0.1.1-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 21.5 kB
Release files / pydubbo-0.1.1.tar.gz
| Download URL | pydubbo-0.1.1.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7b43fa38566b7404e8e7504e8fa18a813be79c75059efda0b233e81df351a2d
|
|
BLAKE2b-256 checksum How to use checksums |
287049debd75ab060261bb6b8d92e848bbee7f3d36c180d3a37d0fe39ef23285
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/2.7
|
Release files / pydubbo-0.1.1-py2-none-any.whl
| Download URL | pydubbo-0.1.1-py2-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
2de7165f6368ae6b17f9bcedcb25c0038f3a0b06a4e7e977524d5be7118ecf49
|
|
BLAKE2b-256 checksum How to use checksums |
aa7723de76c6ccf023bec0eb254deb00ea89a0f9eb56ffc8e06f4b5f8ace4378
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/2.7
|
Security for pydubbo 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.