Geely GBOP Client
Project description
Geely GBOP Client
request demo:
from pygbop import GbopApiClient, Method, BasicAuth
auth = BasicAuth(access_key='xxxxxxxxxxxxxxxxx', secret_key='xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx')
client = GbopApiClient(auth, base_url='hello.api-dev.test.xxxxx.com')
print('=============GET=============')
params = {
'params1': '123',
'params3': ['s', 'w', 'k'],
'params2': '321',
}
res = client.execute(Method.GET, '/api/v1/hello', params)
print(res.decode('utf-8'))
print('=============POST=============')
data = {'params3': 'testA', 'params4': 'testB'}
res = client.execute(Method.POST, '/api/v1/demo', data=data)
print(res.decode('utf-8'))
print('=============POST2=============')
params = {'params3': 'testA', 'params4': 'testB'}
header = {'content-type':'application/json;charset=utf-8'}
res = client.execute(Method.POST, '/api/v1/demo', params=params, data=data, header=header)
print(res.decode('utf-8'))
print('=============response stream=============')
for item in client.execute_with_stream(Method.POST, '/sse', params, data,
header={"Content-Type": "application/json"},
timeout=60):
print(item.decode('utf-8'))
cloud event push demo:
from pygbop import CloudEventBasicAuth, EventPushClient
auth = CloudEventBasicAuth(producer_group='xxxxxxx',
subject='persistent://Information_Technology/xxxx/XXXX_EVENT',
secret_token='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
event_push_client = EventPushClient(auth=auth, base_url='http://xxxx.dev.xxxxx.com')
data = {
"message": "hello 喵啪斯"
}
response = event_push_client.push_message(data=data,
source='xx.cmdb',
type_='xx:cmdb:InstanceChanged')
print(response.decode('utf-8'))
or
from pygbop import CloudEventBasicAuth, EventPushClient
auth = CloudEventBasicAuth(producer_group='xxxxxxx',
subject='persistent://Information_Technology/xxxx/XXXX_EVENT',
secret_token='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
event_push_client = EventPushClient(auth=auth, base_url='http://xxxx.dev.xxxxx.com')
data = {
"message": "hello 喵啪斯"
}
response = event_push_client.push(data=data,
source='xx.cmdb',
type_='xx:cmdb:InstanceChanged')
if response.result:
message_id = response.data
else:
code = response.code
fail_message = response.message
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pygbop-0.2.2.1.tar.gz
(5.0 kB
view details)
Built Distribution
File details
Details for the file pygbop-0.2.2.1.tar.gz
.
File metadata
- Download URL: pygbop-0.2.2.1.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.19 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c702e2ccf7649c3c0a0b092482990cb206552be23f4b55781076b8c83f6c542b |
|
MD5 | 4c44a59800a1f663021f09238bfad5f4 |
|
BLAKE2b-256 | 833b0672aa91b0747864aff5c618526ebdb406e2dd21dd15c8cd395355370de2 |
File details
Details for the file pygbop-0.2.2.1-py2.py3-none-any.whl
.
File metadata
- Download URL: pygbop-0.2.2.1-py2.py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.19 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 959879a933fcbc52e9edb895b6dc7d3bae9f6bda783493611b1d34212461baae |
|
MD5 | 27c9f5c9566c2dc707cf75ef66336d12 |
|
BLAKE2b-256 | 1716427a8f37dd8449c23bb98efd8373b7af31efedd47e9097f7fe74f05ec206 |