Initial commit
This commit is contained in:
25
client.py
Normal file
25
client.py
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import logging
|
||||
import sys
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='HTTP Client')
|
||||
parser.add_argument("--verbose", "-v", action='count', default=0, help="Increase verbosity level of logging")
|
||||
parser.add_argument("--command", "-c", help="HEAD, GET, PUT or POST", default="GET")
|
||||
parser.add_argument("--port", "-p", help="The port used to connect with the server", default=80)
|
||||
parser.add_argument("URI", help="The URI to connect to")
|
||||
|
||||
arguments = parser.parse_args()
|
||||
|
||||
logging.basicConfig(level=logging.ERROR - (10 * arguments.verbose))
|
||||
logging.debug("Arguments: %r", arguments)
|
||||
raise Exception("dsfgsfsd")
|
||||
|
||||
|
||||
try:
|
||||
main()
|
||||
except Exception as e:
|
||||
print("[ABRT] Internal error: "+str(e), file=sys.stderr)
|
||||
logging.debug("Internal error", exc_info=e)
|
||||
sys.exit(70)
|
Reference in New Issue
Block a user