"""Run example application.""" import sys import logging from containers import Core, Application if __name__ == '__main__': # Configure platform: Core.config.update({ 'database': { 'dsn': ':memory:' }, 'aws': { 'access_key_id': 'KEY', 'secret_access_key': 'SECRET' }, 'auth': { 'token_ttl': 3600 } }) Core.logger().addHandler(logging.StreamHandler(sys.stdout)) # Run application: Application.main(uid=sys.argv[1], password=sys.argv[2], photo=sys.argv[3])
from bluetoothscanner import BluetoothTinySineScanner import dependency_injector.providers as providers Core.config.override( dict(target='id1', max_disconnect_pings=5, period=5, presence={'filename': 'blueping.txt'}, bluetoothtinysinescanner={ 'port': 'com14', 'baudrate': 115200, 'serial_timeout_seconds': 30 })) # configure logger Core.logger().setLevel(logging.DEBUG) logFormatter = logging.Formatter("%(asctime)s %(message)s") consoleHandler = logging.StreamHandler() consoleHandler.setFormatter(logFormatter) Core.logger().addHandler(consoleHandler) dateTag = datetime.datetime.now().strftime("%Y-%b-%d_%H-%M-%S") fileHandler = logging.FileHandler("{0}-{1}.txt".format("log", dateTag)) fileHandler.setFormatter(logFormatter) Core.logger().addHandler(fileHandler) # configure presence logger Core.presence_logger().setLevel(logging.INFO) presenceFileHandler = logging.FileHandler(Core.config.presence.filename()) presenceFileHandler.setFormatter(logFormatter) Core.presence_logger().addHandler(presenceFileHandler)