Skip to main content

swtich-py

PyPI version Build Status: License: MIT

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_SECRET the secret key used to sign tokens for switch service, should be same env as the service itself

  • SWITCH_BASE_URL the base url of the hosted switch service

from switcher import publisher
publisher.publish('hellow', 'me', {'body': {'hello': 'world'}})

params in order:

  • topic the topic name you wish to trigger subscribers on

  • author your service identifier string(anything you want)

  • options a dict containing the data you wish to include in your request:

    • body body dict of your request if it's a post/patch/.. request
    • headers headers to be sent to the subscriber in the request headers
    • query_params a dict containing any query params you wish to add to the subscribers' url ({param: value} => https://google.com?param=value)
    • path_params a dict containing any path variables you wish to subtitute if exits in any of the subscirbers url, example {id: 1} https://googl.com/:id will be transformed to https://googl.com/1
    • http_method string 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)

Source distribution for switcher 0.1.8
File Size Uploaded
switcher-0.1.8.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for switcher 0.1.8
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page