Skip to main content

python SDK for switch service to publish messages on topics

Project description

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

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

switcher-0.1.8.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

switcher-0.1.8-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

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

Hashes for switcher-0.1.8.tar.gz
Algorithm Hash digest
SHA256 8789e29f2ffb1f3757567dc34e3eb7669277d8b5be09dfd786158cf88e719419
MD5 0231089fa6394308d8f3863cefebe873
BLAKE2b-256 220eb6d268505c161e757deca83991fc7ef9885e4123ec0600dd824d2c225f09

See more details on using hashes here.

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

Hashes for switcher-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 a36df7708b7d117a9d77fd5280b1f83e586eb51a9f852529ad601c2d9e649456
MD5 c258164dc0f4e341214deebcb9a664dd
BLAKE2b-256 36af5b04523407ecd548b320eb82b08439ebaa1bb0e797e81cab61c9de1a4b58

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page