{"id":29029347,"url":"https://github.com/upstash/qstash-py","last_synced_at":"2026-03-04T23:32:13.383Z","repository":{"id":219000166,"uuid":"733648707","full_name":"upstash/qstash-py","owner":"upstash","description":"Python SDK for Upstash QStash","archived":false,"fork":false,"pushed_at":"2026-02-25T08:20:50.000Z","size":229,"stargazers_count":27,"open_issues_count":4,"forks_count":3,"subscribers_count":7,"default_branch":"main","last_synced_at":"2026-02-25T12:58:44.006Z","etag":null,"topics":["qstash","sdk-python","upstash","upstash-sdk"],"latest_commit_sha":null,"homepage":"https://docs.upstash.com/qstash","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/upstash.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-12-19T20:04:31.000Z","updated_at":"2026-02-25T08:20:53.000Z","dependencies_parsed_at":"2024-01-24T23:23:33.216Z","dependency_job_id":"7f55c6bd-37a8-46e8-a3dc-bc84281aacf7","html_url":"https://github.com/upstash/qstash-py","commit_stats":null,"previous_names":["upstash/qstash-python","upstash/qstash-py"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/upstash/qstash-py","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upstash%2Fqstash-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upstash%2Fqstash-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upstash%2Fqstash-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upstash%2Fqstash-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/upstash","download_url":"https://codeload.github.com/upstash/qstash-py/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upstash%2Fqstash-py/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30099404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T23:31:22.529Z","status":"ssl_error","status_checked_at":"2026-03-04T23:31:22.112Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["qstash","sdk-python","upstash","upstash-sdk"],"created_at":"2025-06-26T08:06:49.479Z","updated_at":"2026-03-04T23:32:13.313Z","avatar_url":"https://github.com/upstash.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Upstash Python QStash SDK\n\n\u003e [!NOTE]  \n\u003e **This project is in GA Stage.**\n\u003e\n\u003e The Upstash Professional Support fully covers this project. It receives regular updates, and bug fixes.\n\u003e The Upstash team is committed to maintaining and improving its functionality.\n\n**QStash** is an HTTP based messaging and scheduling solution for serverless and edge runtimes.\n\n[QStash Documentation](https://upstash.com/docs/qstash)\n\n### Install\n\n```shell\npip install qstash\n```\n\n### Usage\n\nYou can get your QStash token from the [Upstash Console](https://console.upstash.com/qstash).\n\n#### Publish a JSON message\n\n```python\nfrom qstash import QStash\n\nclient = QStash(\"\u003cQSTASH_TOKEN\u003e\")\n\nres = client.message.publish_json(\n    url=\"https://example.com\",\n    body={\"hello\": \"world\"},\n    headers={\n        \"test-header\": \"test-value\",\n    },\n)\n\nprint(res.message_id)\n```\n\n#### [Create a scheduled message](https://upstash.com/docs/qstash/features/schedules)\n\n```python\nfrom qstash import QStash\n\nclient = QStash(\"\u003cQSTASH_TOKEN\u003e\")\n\nschedule_id = client.schedule.create(\n    destination=\"https://example.com\",\n    cron=\"*/5 * * * *\",\n)\n\nprint(schedule_id)\n```\n\n#### [Receiving messages](https://upstash.com/docs/qstash/howto/receiving)\n\n```python\nfrom qstash import Receiver\n\n# Keys available from the QStash console\nreceiver = Receiver(\n    current_signing_key=\"CURRENT_SIGNING_KEY\",\n    next_signing_key=\"NEXT_SIGNING_KEY\",\n)\n\n# ... in your request handler\n\nsignature, body = req.headers[\"Upstash-Signature\"], req.body\n\nreceiver.verify(\n    body=body,\n    signature=signature,\n    url=\"https://example.com\",  # Optional\n)\n```\n\n#### Publish a JSON message to LLM Using Custom Providers\n\n```python\nfrom qstash import QStash\nfrom qstash.chat import openai\n\nclient = QStash(\"\u003cQSTASH_TOKEN\u003e\")\n\nres = client.message.publish_json(\n    api={\"name\": \"llm\", \"provider\": openai(\"\u003cOPENAI_API_KEY\u003e\")},\n    body={\n        \"model\": \"gpt-3.5-turbo\",\n        \"messages\": [\n            {\n                \"role\": \"user\",\n                \"content\": \"What is the capital of Turkey?\",\n            }\n        ],\n    },\n    callback=\"https://example-cb.com\",\n)\n\nprint(res.message_id)\n```\n\n#### Additional configuration\n\n```python\nfrom qstash import QStash\n\n# Create a client with a custom retry configuration. This is\n# for sending messages to QStash, not for sending messages to\n# your endpoints.\n# The default configuration is:\n# {\n#   \"retries\": 5,\n#   \"backoff\": lambda retry_count: math.exp(retry_count) * 50,\n# }\nclient = QStash(\n    token=\"\u003cQSTASH_TOKEN\u003e\",\n    retry={\n        \"retries\": 1,\n        \"backoff\": lambda retry_count: (2 ** retry_count) * 20,\n    },\n)\n\n# Publish to URL\nclient.message.publish_json(\n    url=\"https://example.com\",\n    body={\"key\": \"value\"},\n    # Retry sending message to API 3 times\n    # https://upstash.com/docs/qstash/features/retry\n    retries=3,\n    # Schedule message to be sent 4 seconds from now\n    delay=\"4s\",\n    # When message is sent, send a request to this URL\n    # https://upstash.com/docs/qstash/features/callbacks\n    callback=\"https://example.com/callback\",\n    # When message fails to send, send a request to this URL\n    failure_callback=\"https://example.com/failure_callback\",\n    # Headers to forward to the endpoint\n    headers={\n        \"test-header\": \"test-value\",\n    },\n    # Enable content-based deduplication\n    # https://upstash.com/docs/qstash/features/deduplication#content-based-deduplication\n    content_based_deduplication=True,\n)\n```\n\nAdditional methods are available for managing url groups, schedules, and messages. See the examples folder for more.\n\n### Development\n\n1. Clone the repository\n2. Install [Poetry](https://python-poetry.org/docs/#installation)\n3. Install dependencies with `poetry install`\n4. Create a .env file with `cp .env.example .env` and fill in the `QSTASH_TOKEN`\n5. Run tests with `poetry run pytest`\n6. Format with `poetry run ruff format .`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupstash%2Fqstash-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fupstash%2Fqstash-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupstash%2Fqstash-py/lists"}