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.
This commit is contained in:
parent
63a22e27e0
commit
4f3ef1b102
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import logging
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
import vanth.main
|
||||||
|
import vanth.tables
|
||||||
|
|
||||||
|
LOGGER = logging.getLogger(__name__)
|
||||||
|
def main():
|
||||||
|
vanth.main.setup_logging()
|
||||||
|
config = vanth.main.get_config()
|
||||||
|
engine = vanth.main.create_db_connection(config)
|
||||||
|
|
||||||
|
new_uuid = uuid.uuid4()
|
||||||
|
query = vanth.tables.OFXSource.insert().values( # pylint: disable=no-value-for-parameter
|
||||||
|
uuid = str(new_uuid),
|
||||||
|
name = 'America First Credit Union',
|
||||||
|
fid = '54324',
|
||||||
|
bankid = '324377516',
|
||||||
|
)
|
||||||
|
results = engine.execute(query)
|
||||||
|
LOGGER.info("Created OFX source %s", results.inserted_primary_key[0])
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
|
@ -11,11 +11,13 @@ import vanth.tables
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__name__)
|
LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
def create_application(config):
|
def create_db_connection(config):
|
||||||
sepiida.log.setup_logging()
|
|
||||||
engine = chryso.connection.Engine(config.db, vanth.tables)
|
engine = chryso.connection.Engine(config.db, vanth.tables)
|
||||||
chryso.connection.store(engine)
|
chryso.connection.store(engine)
|
||||||
|
return engine
|
||||||
|
|
||||||
|
def create_application(config):
|
||||||
|
create_db_connection(config)
|
||||||
LOGGER.info("Starting up vanth version %s", vanth.version.VERSION)
|
LOGGER.info("Starting up vanth version %s", vanth.version.VERSION)
|
||||||
application = vanth.server.create_app(config)
|
application = vanth.server.create_app(config)
|
||||||
|
|
||||||
|
@ -23,11 +25,19 @@ def create_application(config):
|
||||||
|
|
||||||
return application
|
return application
|
||||||
|
|
||||||
def main():
|
def setup_logging():
|
||||||
logging.getLogger().setLevel(logging.DEBUG)
|
logging.getLogger().setLevel(logging.DEBUG)
|
||||||
logging.basicConfig()
|
logging.basicConfig()
|
||||||
|
|
||||||
config = sepiida.config.load('/etc/vanth.yaml', vanth.config.SPECIFICATION)
|
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)
|
application = create_application(config)
|
||||||
try:
|
try:
|
||||||
host = os.getenv('HOST', 'localhost')
|
host = os.getenv('HOST', 'localhost')
|
||||||
|
|
Loading…
Reference in New Issue