-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
42 lines (32 loc) · 1.1 KB
/
main.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
41
import argparse
import os
import logging
import requests
from config_loader import ConfigData
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Hello world project with python"
)
parser.add_argument(
"--user",
help="Which username should be checked?",
default="User",
type=str
)
parser.add_argument(
"--config_path",
help="Config file path (default: 'def-config.json')",
default="def-config.json",
)
args = parser.parse_args()
userMatchesSecret: bool = args.user == 'Silvan'
logger.info(f"Given username matches secret: {(userMatchesSecret)}")
secret = os.getenv('SECRET')
logger.info(f"Env variable SECRET in reversed is '{(secret[::-1])}'")
config = ConfigData.load_json_config(args.config_path)
logger.info(f"Performing get request to {config.host}")
response = requests.get(config.host)
status_code = response.status_code
logger.info(f"Status code of the response was {status_code}")