From 1bbabed35184a863fb65635546c877faa2e35232 Mon Sep 17 00:00:00 2001 From: ardabot Date: Wed, 11 Feb 2026 12:47:46 +0000 Subject: [PATCH] feat: implement changes from upstash/qstash-server#884 Automated SDK update by ardabot --- qstash/asyncio/client.py | 17 +++++++++++++++++ qstash/client.py | 17 +++++++++++++++++ tests/asyncio/test_readiness.py | 9 +++++++++ tests/test_readiness.py | 6 ++++++ 4 files changed, 49 insertions(+) create mode 100644 tests/asyncio/test_readiness.py create mode 100644 tests/test_readiness.py diff --git a/qstash/asyncio/client.py b/qstash/asyncio/client.py index b830d15..272e2de 100644 --- a/qstash/asyncio/client.py +++ b/qstash/asyncio/client.py @@ -49,3 +49,20 @@ def __init__( self.dlq = AsyncDlqApi(self.http) """Dlq (Dead Letter Queue) api.""" + + async def readiness(self) -> str: + """ + Checks if the QStash service is ready to accept requests. + + This endpoint is commonly used in orchestration systems (like Kubernetes + readiness probes) to determine when a service is ready to receive traffic. + + :return: "OK" if the service is ready + :raises QStashError: If the request fails + """ + result: str = await self.http.request( + path="/v2/readiness", + method="GET", + parse_response=False, + ) + return result diff --git a/qstash/client.py b/qstash/client.py index 72fe4e5..431c234 100644 --- a/qstash/client.py +++ b/qstash/client.py @@ -50,3 +50,20 @@ def __init__( self.dlq = DlqApi(self.http) """Dlq (Dead Letter Queue) api.""" + + def readiness(self) -> str: + """ + Checks if the QStash service is ready to accept requests. + + This endpoint is commonly used in orchestration systems (like Kubernetes + readiness probes) to determine when a service is ready to receive traffic. + + :return: "OK" if the service is ready + :raises QStashError: If the request fails + """ + result: str = self.http.request( + path="/v2/readiness", + method="GET", + parse_response=False, + ) + return result diff --git a/tests/asyncio/test_readiness.py b/tests/asyncio/test_readiness.py new file mode 100644 index 0000000..e235faf --- /dev/null +++ b/tests/asyncio/test_readiness.py @@ -0,0 +1,9 @@ +import pytest + +from qstash import AsyncQStash + + +@pytest.mark.asyncio +async def test_readiness_async(async_client: AsyncQStash) -> None: + response = await async_client.readiness() + assert response == "OK" diff --git a/tests/test_readiness.py b/tests/test_readiness.py new file mode 100644 index 0000000..8a507d0 --- /dev/null +++ b/tests/test_readiness.py @@ -0,0 +1,6 @@ +from qstash import QStash + + +def test_readiness(client: QStash) -> None: + response = client.readiness() + assert response == "OK"