def set_default(key): if 'APIC_' + key.upper() in os.environ.keys(): return os.environ['APIC_' + key.upper()] else: try: import credentials except ImportError: print 'credentials.py does not exist.' return '' return credentials.__getattribute__(key.upper())
def set_default(key): if 'APIC_' + key.upper() in os.environ.keys(): return os.environ['APIC_' + key.upper()] else: try: import credentials except ImportError: return None try: default = credentials.__getattribute__(key.upper()) return default except AttributeError: return None
def set_default(key): """ Check for the following: - environmental variables - credentials.py file """ if 'NX_' + key.upper() in os.environ.keys(): return os.environ['NX_' + key.upper()] else: try: import credentials except ImportError: return None try: default = credentials.__getattribute__(key.upper()) return default except AttributeError: return None