From 8cfefdc4a38e5938d183425bdc63f319320bf943 Mon Sep 17 00:00:00 2001 From: ardabot Date: Wed, 11 Feb 2026 12:59:57 +0000 Subject: [PATCH] feat: implement changes from upstash/qstash-server#884 Automated SDK update by ardabot --- qstash/asyncio/client.py | 24 ++++++++++++++++++++++++ qstash/client.py | 24 ++++++++++++++++++++++++ tests/asyncio/test_health.py | 15 +++++++++++++++ tests/test_health.py | 11 +++++++++++ 4 files changed, 74 insertions(+) create mode 100644 tests/asyncio/test_health.py create mode 100644 tests/test_health.py diff --git a/qstash/asyncio/client.py b/qstash/asyncio/client.py index b830d15..c5aa916 100644 --- a/qstash/asyncio/client.py +++ b/qstash/asyncio/client.py @@ -49,3 +49,27 @@ def __init__( self.dlq = AsyncDlqApi(self.http) """Dlq (Dead Letter Queue) api.""" + + async def liveness(self) -> str: + """ + Check if the QStash API is alive. + + :return: "OK" if the API is alive. + """ + return await self.http.request( + path="/v2/liveness", + method="GET", + parse_response=False, + ) + + async def readiness(self) -> str: + """ + Check if the QStash API is ready to accept requests. + + :return: "OK" if the API is ready. + """ + return await self.http.request( + path="/v2/readiness", + method="GET", + parse_response=False, + ) diff --git a/qstash/client.py b/qstash/client.py index 72fe4e5..2a819ce 100644 --- a/qstash/client.py +++ b/qstash/client.py @@ -50,3 +50,27 @@ def __init__( self.dlq = DlqApi(self.http) """Dlq (Dead Letter Queue) api.""" + + def liveness(self) -> str: + """ + Check if the QStash API is alive. + + :return: "OK" if the API is alive. + """ + return self.http.request( + path="/v2/liveness", + method="GET", + parse_response=False, + ) + + def readiness(self) -> str: + """ + Check if the QStash API is ready to accept requests. + + :return: "OK" if the API is ready. + """ + return self.http.request( + path="/v2/readiness", + method="GET", + parse_response=False, + ) diff --git a/tests/asyncio/test_health.py b/tests/asyncio/test_health.py new file mode 100644 index 0000000..6721b10 --- /dev/null +++ b/tests/asyncio/test_health.py @@ -0,0 +1,15 @@ +import pytest + +from qstash import AsyncQStash + + +@pytest.mark.asyncio +async def test_liveness_async(async_client: AsyncQStash) -> None: + result = await async_client.liveness() + assert result == "OK" + + +@pytest.mark.asyncio +async def test_readiness_async(async_client: AsyncQStash) -> None: + result = await async_client.readiness() + assert result == "OK" diff --git a/tests/test_health.py b/tests/test_health.py new file mode 100644 index 0000000..f1d6a0a --- /dev/null +++ b/tests/test_health.py @@ -0,0 +1,11 @@ +from qstash import QStash + + +def test_liveness(client: QStash) -> None: + result = client.liveness() + assert result == "OK" + + +def test_readiness(client: QStash) -> None: + result = client.readiness() + assert result == "OK"