Examples
URL Groups
You can run the async code by importing AsyncQStash
from qstash
and awaiting the methods.
Create a URL group and add 2 endpoints
from qstash import QStash
client = QStash("<QSTASH-TOKEN>")
client.url_group.upsert_endpoints(
url_group="my-url-group",
endpoints=[
{"url": "https://my-endpoint-1"},
{"url": "https://my-endpoint-2"},
],
)
Get URL group by name
from qstash import QStash
client = QStash("<QSTASH-TOKEN>")
url_group = client.url_group.get("my-url-group")
print(url_group.name, url_group.endpoints)
List URL groups
from qstash import QStash
client = QStash("<QSTASH-TOKEN>")
all_url_groups = client.url_group.list()
for url_group in all_url_groups:
print(url_group.name, url_group.endpoints)
Remove an endpoint from a URL group
from qstash import QStash
client = QStash("<QSTASH-TOKEN>")
client.url_group.remove_endpoints(
url_group="my-url-group",
endpoints=[
{"url": "https://my-endpoint-1"},
],
)
Delete a URL group
from qstash import QStash
client = QStash("<QSTASH-TOKEN>")
client.url_group.delete("my-url-group")