Configurations should be stored in a configuration file(.cfg /.ini /.env) .
You can use Python Decouple for simple usecase without namespaces. If you want to use namespaces check out the inbuilt ConfigParser module. This is because if you share your code for review or to some forum to get your errors resolved you might accidentally give your secret information which can allow other users to access your data. This has happened a few times with me when I was sharing error logs and code on IRC chat.
Check for python None values.
There is a difference between if a is None and if not a.
>>> [] is None
False
You see it? Therefore if you want to check for empty dictionary, empty list, empty string, your all in one solution is if not. More to read on stackoverflow Python: if not val, vs if val is None
if host is None:
can be
if not host: