25 lines
861 B
Python
25 lines
861 B
Python
#!/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) |