vanth/vanth/main.py
Eli Ribble 4f3ef1b102 Add simple script for inserting ofxsources
This only adds one institution that I care about, AFCU, but could be
extended to use the data from ofxhome.com. I downloaded the data from
them but found two problems. One, they work in XML, which I don't feel
like parsing, but two and far more importantly, they provide the second
piece of data I need, the routing number for the bank. That sucks. So
it's likely that if this project does well we will have more data than
them.
2016-05-18 15:42:46 -06:00

47 lines
1.1 KiB
Python

import logging
import os
import chryso.connection
import sepiida.config
import sepiida.log
import vanth.config
import vanth.server
import vanth.tables
LOGGER = logging.getLogger(__name__)
def create_db_connection(config):
engine = chryso.connection.Engine(config.db, vanth.tables)
chryso.connection.store(engine)
return engine
def create_application(config):
create_db_connection(config)
LOGGER.info("Starting up vanth version %s", vanth.version.VERSION)
application = vanth.server.create_app(config)
logging.getLogger('vanth.cors').setLevel(logging.WARNING)
return application
def setup_logging():
logging.getLogger().setLevel(logging.DEBUG)
logging.basicConfig()
sepiida.log.setup_logging()
def get_config():
return sepiida.config.load('/etc/vanth.yaml', vanth.config.SPECIFICATION)
def main():
setup_logging()
config = get_config()
application = create_application(config)
try:
host = os.getenv('HOST', 'localhost')
port = int(os.getenv('PORT', 4545))
application.run(host, port)
except KeyboardInterrupt:
LOGGER.info('Shutting down')