Skip to main content

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'))

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


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.0.6.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

pygbop-0.2.0.6-py2.py3-none-any.whl (5.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pygbop-0.2.0.6.tar.gz.

File metadata

  • Download URL: pygbop-0.2.0.6.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.12 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

Hashes for pygbop-0.2.0.6.tar.gz
Algorithm Hash digest
SHA256 a288df1feff90348edf1f49d784ef6dec923ae8527064400336d487f13216879
MD5 0e5205c2f3f2f17309bd06c2e02c3aa2
BLAKE2b-256 e510b1f29284e3f07bf1f2c379e308e5d408b58d6d04d02c47f8bdb54bff7f4b

See more details on using hashes here.

File details

Details for the file pygbop-0.2.0.6-py2.py3-none-any.whl.

File metadata

  • Download URL: pygbop-0.2.0.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.12 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

Hashes for pygbop-0.2.0.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e3781a31d429e131897890209abe102a18f0d9e5b6860f2986e07674e746d038
MD5 21ccfaa57b57ea49d4d77e5048221893
BLAKE2b-256 9b7f856308e98aada8aac684d352c2d02d35d833bbc651ae79d4fb53acbd7c5d

See more details on using hashes here.

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