Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def init_app():
- '''
- Method for reading the settings.ini file and get the useful information out of it
- Returns
- -------
- environment : str
- String containing the environment we are using. (dev,qa,prd)
- application : str
- String containing the application we are using. (tips,achievements, etc..)
- test_mode : int
- (0,1), 1 if execution should be done in test mode, 0 if not (not implemented yet)
- '''
- try:
- module_path = path.dirname(path.abspath(__file__))
- config_file_path = module_path + '/settings.ini'
- print("Script running on the production machine")
- except NameError:
- print("Script running on the sandbox machine")
- config_file_path = "settings.ini"
- config = configparser.ConfigParser()
- config.read(config_file_path)
- environment = config.get("App_info", "environment")
- application = config.get("App_info", "application")
- user = config.get("App_info", "user")
- password = config.get("App_info", "password")
- return environment,application,user,password
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement