def run_server(args): os.environ["FLAMYNGO"] = args.config from flamyngo.app import app if args.browser: from multiprocessing import Process p = Process(target=app.run, kwargs={"debug": args.debug, "host": args.host, "port": args.port}) p.start() time.sleep(2) webbrowser.open("http://{}:{}".format(args.host, args.port)) p.join() else: app.run(debug=args.debug, host=args.host, port=args.port)
def run_server(args): """ Run server """ os.environ["FLAMYNGO"] = args.config from flamyngo.app import app, SETTINGS if args.browser: from multiprocessing import Process p = Process( target=app.run, kwargs={ "debug": args.debug, "host": args.host, "port": args.port }, ) p.start() time.sleep(2) webbrowser.open(f"http://{args.host}:{args.port}") p.join() else: app.run(debug=args.debug, host=args.host, port=args.port)
except TypeError: # Handle integer indices val = val[int(t)] val = process(val, processing_func) except Exception: # Return the base value if we cannot descend into the data. val = None return val def _search_dict(dictionary, substr): result = [] for key in dictionary: if substr.lower() in key.lower(): result.append(key) return result if "additional_endpoints" in SETTINGS: for rule, endpoint in SETTINGS["additional_endpoints"].items(): toks = endpoint.rsplit(".", 1) if len(toks) == 1: func = globals()["__builtins__"][toks[0]] else: mod = __import__(toks[0], globals(), locals(), [toks[1]], 0) func = getattr(mod, toks[1]) app.add_url_rule(rule, view_func=func) if __name__ == "__main__": app.run(debug=True)
return val def _get_val(k, d, processing_func): toks = k.split(".") try: val = d[toks[0]] for t in toks[1:]: try: val = val[t] except KeyError: # Handle integer indices val = val[int(t)] val = process(val, processing_func) except Exception as ex: # Return the base value if we cannot descend into the data. val = None return val def _search_dict(dictionary, substr): result = [] for key in dictionary: if substr.lower() in key.lower(): result.append(key) return result if __name__ == "__main__": app.run(debug=True)