def start_webapp(config): """Starts the Flask server.""" app.secret_key = 'super secret key' # app.config['SESSION_TYPE'] = 'filesystem' # Get config variables if "imageryURL" not in config: print("[ERROR] Could not find imageryURL in the config file!") # Get the imagery URL and access key imagery_url = config["imageryURL"] access_key = "" if "accessKey" in config: access_key = config["accessKey"] # Create imagery downloader global imd imd = imagery.ImageryDownloader(imagery_url, access_key) global program_config program_config = config global osm init_info = program_config["osmUpload"] args = ["api", "username", "password"] for arg in args: if arg not in init_info: print("[ERROR] Config: osmUpload->" + arg + " not found!") return "BREAK" # initializes the class for interacting with OpenStreetMap's API osm = backend.OSM_Interactor(init_info["api"], init_info["username"], init_info["password"]) app.debug = True app.run()
def get_imd(): # do imd = get_imd() in all functions config = get_program_config() return imagery.ImageryDownloader(config['accessKey'])
# run the application. if __name__ == "__main__": config = config_reader.get_config() # useless application.secret_key = 'super secret key' # Get config variables access_key = None if "accessKey" in config: access_key = config["accessKey"] # Create imagery downloader imd = imagery.ImageryDownloader(access_key) program_config = config init_info = program_config["osmUpload"] args = ["api", "username", "password"] for arg in args: if arg not in init_info: print("[ERROR] Config: osmUpload->" + arg + " not found!") raise ValueError() # initializes the class for interacting with OpenStreetMap's API osm = backend.OSM_Interactor(init_info["api"], init_info["username"], init_info["password"]) application.debug = True