-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
40 lines (34 loc) · 896 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import argparse
import sys
from infoenergia_api import build_app
app = build_app("infoenergia-api-run")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Infoenergia api service")
parser.add_argument(
"-H",
"--host",
help="host address to serve (default: %(default)r",
type=str,
default="0.0.0.0",
)
parser.add_argument(
"-p",
"--port",
help="TCP/IP port to serve (default: %(default)r",
type=int,
default=9000,
)
args = parser.parse_args()
try:
app.run(
host=args.host,
port=args.port,
debug=True,
auto_reload=True,
)
except (KeyboardInterrupt, SystemExit):
print("You kill me!!")
except Exception as e:
print(f"What the fuck @!#!:{e}")
finally:
sys.exit(0)