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
Metadata
Release files for switcher 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| switcher-0.1.8.tar.gz | 3.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| switcher-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.5 kB
Release files / switcher-0.1.8.tar.gz
| Download URL | switcher-0.1.8.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8789e29f2ffb1f3757567dc34e3eb7669277d8b5be09dfd786158cf88e719419
|
|
BLAKE2b-256 checksum How to use checksums |
220eb6d268505c161e757deca83991fc7ef9885e4123ec0600dd824d2c225f09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / switcher-0.1.8-py3-none-any.whl
| Download URL | switcher-0.1.8-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a36df7708b7d117a9d77fd5280b1f83e586eb51a9f852529ad601c2d9e649456
|
|
BLAKE2b-256 checksum How to use checksums |
36af5b04523407ecd548b320eb82b08439ebaa1bb0e797e81cab61c9de1a4b58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|