Initial commit

This commit is contained in:
2021-03-13 13:13:36 +01:00
commit e383a73425
6 changed files with 257 additions and 0 deletions

25
client.py Normal file
View 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)