You can run the async code by importing Client from upstash_qstash.asyncio and awaiting the methods.
Client
upstash_qstash.asyncio
from upstash_qstash import Client client = Client("<QSTASH_TOKEN>") topics = client.topics() topics.upsert_or_add_endpoints( { "name": "topic_name", "endpoints": [ {"url": "https://my-endpoint-1"}, {"url": "https://my-endpoint-2"} ], } )
from upstash_qstash import Client client = Client("<QSTASH_TOKEN>") topics = client.topics() topic = topics.get("topic_name") print(topic["name"], topic["endpoints"])
from upstash_qstash import Client client = Client("<QSTASH_TOKEN>") topics = client.topics() all_topics = topics.list() for topic in all_topics: print(topic["name"], topic["endpoints"])
from upstash_qstash import Client client = Client("<QSTASH_TOKEN>") topics = client.topics() topics.remove_endpoints( { "name": "topic_name", "endpoints": [ {"url": "https://my-endpoint-1"}, ], } )
from upstash_qstash import Client client = Client("<QSTASH_TOKEN>") topics = client.topics() topics.delete("topic_name")
Was this page helpful?