Add pulsar API token check

This commit is contained in:
Tyler O 2025-02-10 16:30:53 +00:00
parent d0ae772fd6
commit a5d5b4ca4a
56 changed files with 319 additions and 82 deletions

View file

@ -13,10 +13,11 @@ import io
import sys
default_pulsar_host = os.getenv("PULSAR_HOST", 'pulsar://localhost:6650')
default_pulsar_api_key = os.getenv("PULSAR_API_KEY", None)
def show_graph(pulsar):
def show_graph(pulsar, pulsar_api_key=None):
tq = TriplesQueryClient(pulsar_host=pulsar)
tq = TriplesQueryClient(pulsar_host=pulsar, pulsar_api_key=pulsar_api_key)
rows = tq.request(None, None, None, limit=10_000_000)
@ -60,12 +61,18 @@ def main():
default=default_pulsar_host,
help=f'Pulsar host (default: {default_pulsar_host})',
)
parser.add_argument(
'--pulsar-api-key',
default=default_pulsar_api_key,
help=f'Pulsar API key',
)
args = parser.parse_args()
try:
show_graph(args.pulsar_host)
show_graph(args.pulsar_host, pulsar_api_key=args.pulsar_api_key)
except Exception as e: