mirror of
https://github.com/cve-search/pyvariot.git
synced 2024-11-23 15:27:22 +00:00
27 lines
738 B
Python
27 lines
738 B
Python
|
from __future__ import annotations
|
||
|
|
||
|
import argparse
|
||
|
import json
|
||
|
import sys
|
||
|
|
||
|
from .api import PyProject
|
||
|
|
||
|
__all__ = ['PyProject']
|
||
|
|
||
|
|
||
|
def main() -> None:
|
||
|
parser = argparse.ArgumentParser(description='Query a thing.')
|
||
|
parser.add_argument('--url', type=str, required=True, help='URL of the instance.')
|
||
|
group = parser.add_mutually_exclusive_group(required=True)
|
||
|
group.add_argument('--redis_up', action='store_true', help='Check if redis is up.')
|
||
|
args = parser.parse_args()
|
||
|
|
||
|
client = PyProject(args.url)
|
||
|
|
||
|
if not client.is_up:
|
||
|
print(f'Unable to reach {client.root_url}. Is the server up?')
|
||
|
sys.exit(1)
|
||
|
if args.redis_up:
|
||
|
response = client.redis_up()
|
||
|
print(json.dumps(response, indent=2))
|