Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions chaos-client.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
import requests
import argparse
from chaos_python.client import chaosAPI as chaosapi

parser = argparse.ArgumentParser(description='Python client to communicate with Chaos API', add_help=True)
required = parser.add_argument_group('Required arguments')
required.add_argument('--domain', metavar='example.com', help='Domain to find subdomains for', required=True)
required.add_argument('--key', metavar='xxxxxxxxxxx', help='Chaos key for API', required=True)
chaos_opt = parser.add_argument_group('Optional arguments')
_ = chaos_opt.add_argument('--count', action='store_true', help='Show statistics for the specified domain')
_ = chaos_opt.add_argument('--json', action='store_true', help='Show statistics for the specified domain')
args = parser.parse_args()

def main():
if args.count:
Expand All @@ -22,4 +12,15 @@ def main():
print(f"{subdomain}")

if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Python client to communicate with Chaos API', add_help=True)

required = parser.add_argument_group('Required arguments')
required.add_argument('--domain', metavar='example.com', help='Domain to find subdomains for', required=True)
required.add_argument('--key', metavar='xxxxxxxxxxx', help='Chaos key for API', required=True)

chaos_opt = parser.add_argument_group('Optional arguments')
chaos_opt.add_argument('--count', action='store_true', help='Show statistics for the specified domain')
chaos_opt.add_argument('--json', action='store_true', help='Show statistics for the specified domain')

args = parser.parse_args()
main()
2 changes: 1 addition & 1 deletion chaos_python/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ def chaosAPI(domain, key, opt):
elif opt == 'json':
return response
else:
return "Please define an options"
return "Please define an option"