python SDK for switch service to publish messages on topics
Project description
swtich-py
python version of switch sdk, allows to publish messages on any topic to trigger all configured subscribers at switch service. https://github.com/Kareem-Emad/switch
Setup
To install the package
pip install switcher
How To Use
first make sure you set up the env variable properlly for:
-
SWITCH_JWT_SECRETthe secret key used to sign tokens for switch service, should be same env as the service itself -
SWITCH_BASE_URLthe base url of the hosted switch service
from switcher import publisher
publisher.publish('hellow', 'me', {'body': {'hello': 'world'}})
params in order:
-
topicthe topic name you wish to trigger subscribers on -
authoryour service identifier string(anything you want) -
optionsa dict containing the data you wish to include in your request:bodybody dict of your request if it's a post/patch/.. requestheadersheaders to be sent to the subscriber in the request headersquery_paramsa dict containing any query params you wish to add to the subscribers' url ({param: value}=>https://google.com?param=value)path_paramsa dict containing any path variables you wish to subtitute if exits in any of the subscirbers url, example{id: 1}https://googl.com/:idwill be transformed tohttps://googl.com/1http_methodstring representing the http method you wish to use when triggering the subscribers for this topic
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file switcher-0.1.8.tar.gz.
File metadata
- Download URL: switcher-0.1.8.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8789e29f2ffb1f3757567dc34e3eb7669277d8b5be09dfd786158cf88e719419
|
|
| MD5 |
0231089fa6394308d8f3863cefebe873
|
|
| BLAKE2b-256 |
220eb6d268505c161e757deca83991fc7ef9885e4123ec0600dd824d2c225f09
|
File details
Details for the file switcher-0.1.8-py3-none-any.whl.
File metadata
- Download URL: switcher-0.1.8-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a36df7708b7d117a9d77fd5280b1f83e586eb51a9f852529ad601c2d9e649456
|
|
| MD5 |
c258164dc0f4e341214deebcb9a664dd
|
|
| BLAKE2b-256 |
36af5b04523407ecd548b320eb82b08439ebaa1bb0e797e81cab61c9de1a4b58
|