{"id":20840842,"url":"https://github.com/kareem-emad/switch-py","last_synced_at":"2026-04-22T11:07:12.333Z","repository":{"id":57472778,"uuid":"298658011","full_name":"Kareem-Emad/switch-py","owner":"Kareem-Emad","description":"Python SDK for switch service allowing you to publish messages on topics that trigger the registered subscribers at switch service","archived":false,"fork":false,"pushed_at":"2020-09-26T00:11:39.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-20T13:46:27.550Z","etag":null,"topics":["events","pubsub","sdk"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kareem-Emad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-25T19:05:36.000Z","updated_at":"2020-09-26T00:11:41.000Z","dependencies_parsed_at":"2022-08-30T13:50:30.130Z","dependency_job_id":null,"html_url":"https://github.com/Kareem-Emad/switch-py","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kareem-Emad%2Fswitch-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kareem-Emad%2Fswitch-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kareem-Emad%2Fswitch-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kareem-Emad%2Fswitch-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kareem-Emad","download_url":"https://codeload.github.com/Kareem-Emad/switch-py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243196657,"owners_count":20251861,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["events","pubsub","sdk"],"created_at":"2024-11-18T01:17:59.227Z","updated_at":"2025-12-26T11:46:57.886Z","avatar_url":"https://github.com/Kareem-Emad.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swtich-py\n\n[![PyPI version](https://badge.fury.io/py/switcher.svg)](https://badge.fury.io/py/switcher)\n[![Build Status:](https://github.com/Kareem-Emad/switch-py/workflows/build/badge.svg)](https://github.com/Kareem-Emad/switch-py/actions)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\npython version of switch sdk, allows to publish messages on any topic to trigger all configured\nsubscribers at switch service.\n\u003chttps://github.com/Kareem-Emad/switch\u003e\n\n## Setup\n\nTo install the package\n\n```shell\npip install switcher\n```\n\n## How To Use\n\nfirst make sure you set up the env variable properlly for:\n\n- `SWITCH_JWT_SECRET` the secret key used to sign tokens for switch service, should be same env as the service itself\n\n- `SWITCH_BASE_URL` the base url of the hosted switch service\n\n```python\nfrom switcher import publisher\npublisher.publish('hellow', 'me', {'body': {'hello': 'world'}})\n```\n\nparams in order:\n\n- `topic` the topic name you wish to trigger subscribers on\n- `author` your service identifier string(anything you want)\n- `options` a dict containing the data you wish to include in your request:\n\n  - `body` body dict of your request if it's a post/patch/.. request\n  - `headers` headers to be sent to the subscriber in the request headers\n  - `query_params` a dict containing any query params you wish to add to the subscribers' url (`{param: value}` `=\u003e` `https://google.com?param=value`)\n  - `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`\n  - `http_method` string representing the http method you wish to use when triggering the subscribers for this topic\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkareem-emad%2Fswitch-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkareem-emad%2Fswitch-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkareem-emad%2Fswitch-py/lists"}