ext-respondd.py 1018 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env python3
  2. import json
  3. import argparse
  4. import sys
  5. from lib.respondd_client import ResponddClient
  6. parser = argparse.ArgumentParser()
  7. parser.add_argument('-d', '--test', action='store_true', help='Test Output', required=False)
  8. parser.add_argument('-v', '--verbose', action='store_true', help='Verbose Output', required=False)
  9. args = parser.parse_args()
  10. options = vars(args)
  11. config = {}
  12. try:
  13. with open("config.json", 'r') as cfg_handle:
  14. config = json.load(cfg_handle)
  15. except IOError:
  16. raise
  17. if options["test"]:
  18. from lib.nodeinfo import Nodeinfo
  19. from lib.statistics import Statistics
  20. from lib.neighbours import Neighbours
  21. print(json.dumps(Nodeinfo(config).getStruct(), sort_keys=True, indent=4))
  22. print(json.dumps(Statistics(config).getStruct(), sort_keys=True, indent=4))
  23. print(json.dumps(Neighbours(config).getStruct(), sort_keys=True, indent=4))
  24. sys.exit(1)
  25. if options["vebose"]:
  26. config["verbose"] = True
  27. extResponddClient = ResponddClient(config)
  28. extResponddClient.start()