sdk
实现sdk调用中mqtt,http,rpc
如何写sdk调用其他服务http接口
要写A服务的sdk,A服务提供了1个http接口login,确定参数,在方法中实现具体的调用,如调用地址,使用post/get/put/patch等,最后返回结果
ret = SdkInterface.login(username="admin", password="c93ccd78b2076528346216b3b2f701e6", http_api_version="4.7.1")
要写A服务的sdk,A服务提供了1个rpc接口,确定参数,在方法中实现具体的调用,如调用地址,console服务名,最后返回结果
SdkInterface.query_check(data=param)
要写A服务的sdk,A服务需要一个topic,定义topic数据结构,
ret2 = SdkInterface.check(param=param)
订阅A服务topic, 定义回调函数,在回调函数中处理数据
SdkInterface.test_subscribe(lambda client, userdata, msg: print(msg.payload))
包制作
https://zhuanlan.zhihu.com/p/79164800
- python3.9 -m pip install --user --upgrade setuptools wheel twine
- python3.9 setup.py sdist bdist_wheel
- python3.9 -m twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
Metadata
Release files for gs-sdk 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gs_sdk-2.0.0.tar.gz | 10.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gs_sdk-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.2 kB
Release files / gs_sdk-2.0.0.tar.gz
| Download URL | gs_sdk-2.0.0.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5fbbcc5e979e11d275e11e4066e0149d746f9f5f5023a180f699ecf121c70342
|
|
BLAKE2b-256 checksum How to use checksums |
fdde9eac04e40baab27f29c2402cb5b41a6455a62eec1dacd29e9b893c69eb1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2
|
Release files / gs_sdk-2.0.0-py3-none-any.whl
| Download URL | gs_sdk-2.0.0-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
273dc3925ae05e16de4457df8c393d7d1fb4134e3364b97ec11334f231232587
|
|
BLAKE2b-256 checksum How to use checksums |
ff6fdcede51dbdb2d58b6096976e193c39c79bdd248fe6fc550984558adc815a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2
|