{"id":21844,"library":"qstash","title":"Upstash QStash Python SDK","description":"Python SDK for Upstash QStash, a message queue and workflow orchestration service for serverless applications. v3.4.0 removes deprecated LLMs support and adds new QStash features. Regular releases.","status":"active","version":"3.4.0","language":"python","source_language":"en","source_url":"https://github.com/upstash/qstash-py","tags":["qstash","upstash","message-queue","serverless","sdk"],"install":[{"cmd":"pip install qstash","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"The correct import is directly from 'qstash'.","wrong":"from qstash.client import QStashClient","symbol":"QStashClient","correct":"from qstash import QStashClient"},{"note":"","wrong":"","symbol":"QStashAsyncClient","correct":"from qstash import QStashAsyncClient"}],"quickstart":{"code":"import os\nfrom qstash import QStashClient\n\nclient = QStashClient(token=os.environ.get('QSTASH_TOKEN', ''))\nresponse = client.publish(url=\"https://example.com/api\", body=\"Hello, QStash!\")\nprint(response)","lang":"python","description":"Initialize client with your QStash token (from Upstash console) and publish a message."},"warnings":[{"fix":"Migrate to a separate LLM SDK (e.g., OpenAI) and remove usage of deprecated methods.","message":"In v3.0.0, the entire LLM chat completion support was removed. Any code using `client.llm.chat` or similar will break.","severity":"breaking","affected_versions":"<3.0.0"},{"fix":"Remove these parameters; if you need delayed execution, use schedules or set a later `not_before` via the API's `schedule` method.","message":"The `delay` and `not_before` parameters in `enqueue` are removed in v2.0.1+. Use `schedule` or manual delay instead.","severity":"deprecated","affected_versions":"<2.0.1"},{"fix":"Check that the environment variable exists before creating the client: `assert os.environ.get('QSTASH_TOKEN'), 'Missing QStash token'`","message":"Client initialization can fail silently if the token is missing; always validate `QSTASH_TOKEN` is set.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure you use `await` inside an async function or run with `asyncio.run()`. Example: `asyncio.run(main())`.","message":"Async client requires an event loop; using it in synchronous context will raise RuntimeError.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `from qstash import QStashClient` instead.","cause":"Incorrect import path for QStashClient.","error":"ModuleNotFoundError: No module named 'qstash.client'"},{"fix":"Use `QStashClient` instead of `QStash`. Import from `qstash`.","cause":"The class was renamed; older code uses `QStash`.","error":"ImportError: cannot import name 'QStash' from 'qstash'"},{"fix":"Set the environment variable `QSTASH_TOKEN` properly. Obtain from Upstash dashboard under QStash > Settings.","cause":"Missing or invalid QStash token.","error":"qstash.errors.QStashError: Authentication failed"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}