def testApp(self): server.request.environ['beaker.session'] = {} assert "You must be logged in" in server.app() server.request.environ['beaker.session'] = { 'nameObject': NAME_RESPONSE['data']['name'] } assert "Aaron McClure" in server.app()
# coding=utf-8 from server import app application=app()
hospital.m_bsi = d['score'] hospital.m_bsi_natl = d['compared_to_national'] elif d['measure_id'] == "PSI_12_POSTOP_PULMEMB_DVT": hospital.m_dvt = d['score'] hospital.m_dvt_natl = d['compared_to_national'] elif d['measure_id'] == "PSI_3_ULCER": hospital.m_ulcer = d['score'] hospital.m_ulcer_natl = d['compared_to_national'] elif d['measure_id'] == "PSI_14_POSTOP_DEHIS": hospital.m_wound_dehis = d['score'] hospital.m_wound_dehis_natl = d['compared_to_national'] elif d['measure_id'] == "PSI_15_ACC_LAC": hospital.m_lac = d['score'] hospital.m_lac_natl = d['compared_to_national'] except: print(f'Measure id: {measure_id} will not be saved at this time') ########################### if __name__ == "__main__": app = app() app.app_context().push() connect_to_db(app) db.create_all() print("Connected to db")
def application(environ, start_response): return app(environ, start_response)
import server app = server.app() if __name__ == '__main__': app.run(debug=True)
# a včíl to možu rozparsovat args = parser.parse_args() logging.basicConfig(level=args.logovací_úroveň) odsek = 24 print('-' * odsek) print('routuji cestu "{}"'.format(args.cesta)) print('-' * odsek) environ = {'PATH_INFO': args.cesta} from pruga.web.Request import Request request = Request(environ) from server import app # import sys # current_module = sys.modules[__name__] jméno_aplikace = request.cesta[0] ## jméno_aplikace = jméno_aplikace.split('.', 1)[0] print('jméno aplikace', jméno_aplikace) obsah = app(environ, print) print('obsah') for prvek_obsahu in obsah: print(prvek_obsahu.decode('utf-8')) print('.' * odsek, sep='')
# coding=utf-8 from server import app application = app()
print("\n\nBot startet...\n") else: with open(r"utils/keys/testbot.env") as f: token = f.read() print("\n\nStarting Test...\n") loop = asyncio.get_event_loop() bot = Bot() try: loop.run_until_complete(bot.create_db_pool()) except: print('Es konnte keine Verbindung zu PostgreSQL aufgebaut werden') exit() try: loop.run_until_complete(bot.create_redis_pool()) except: print('Es konnte keine Verbindung zu RedisDB aufgebaut werden') exit() try: web = server.app(bot, bot.db) web.listen(8888) asyncio.ensure_future(bot.start(token)) except KeyboardInterrupt: loop.run_until_complete(bot.logout()) print('Bot disconnected') loop.run_forever()
logging.basicConfig(level = args.logovací_úroveň) odsek = 24 print('-'*odsek) print('routuji cestu "{}"'.format(args.cesta)) print('-'*odsek) environ = {'PATH_INFO': args.cesta } from pruga.web.Request import Request request = Request(environ) from server import app # import sys # current_module = sys.modules[__name__] jméno_aplikace = request.cesta[0] ## jméno_aplikace = jméno_aplikace.split('.', 1)[0] print('jméno aplikace', jméno_aplikace) obsah = app(environ, print) print('obsah') for prvek_obsahu in obsah: print(prvek_obsahu.decode('utf-8')) print('.'*odsek, sep='')