Exemple #1
0
    def add_bank(self, id=None, username=None, password=None):

        cherrypy.response.headers['Content-Type'] = 'application/json'
        cherrypy.response.status = 200

        result = {'status': 'ok', 'message': ''}
        if id and username and password:
            bank = OFXHome.lookup(id)
            i = Institution(id=bank['fid'],
                            org=bank['org'],
                            url=bank['url'],
                            broker_id=bank['brokerid'],
                            description=bank['name'],
                            username=username,
                            password=password)
            try:
                i.authenticate()
            except Exception as e:
                result['status'] = 'error'
                result[
                    'message'] = 'unable to log into bank with those credentials'

            for a in i.accounts():
                GlobalConfig.add_account(a)
            GlobalConfig.save()
        else:
            result['status'] = 'error'
            result['message'] = 'id, username, and password are all required'

        ret = json.dumps(result)
        cherrypy.response.body = ret
        if result['status'] == 'error':
            cherrypy.response.status = 400
        return ret
def listTransactions(kvstore_url, days, fi_id, fi_org, url, ofx_version, domain):
    """
    Get SimpleFIN-style list of accounts and transactions.
    """
    username = getValue(kvstore_url, 'username', 'Account/Username?')
    password = getValue(kvstore_url, 'password', 'Password/PIN?')

    inst = Institution(
        id=fi_id,
        org=fi_org,
        url=url,
        username=username,
        password=password,
        client_args={
            'ofx_version': ofx_version,
        })
    accounts = inst.accounts()
    return ofxToDict(accounts, days=days,
        domain=domain,
        id_getter=partial(getID, kvstore_url))
Exemple #3
0
def _init_ofx():
    global ACCT
    if ACCT is None:
        inst = Institution(
            id='211371120',
            org='DI',
            url='https://ofxdi.diginsite.com/cmr/cmr.ofx',
            description=u'Cambridge Savings Bank',
            username=secrets.OFX_USERNAME,
            password=secrets.OFX_PASSWORD,
            client_args={
                'id': 'eb1c23b1102c4fe78f7e17f9685c3c89',
            },
        )
        for account in inst.accounts():
            if account.number_masked() == u'***8059':
                ACCT = account
                break
        else:
            print "Couldn't find joint account."
            sys.exit(1)
Exemple #4
0
    def add_bank(self,id=None,username=None,password=None):

        cherrypy.response.headers['Content-Type'] = 'application/json'
        cherrypy.response.status = 200

        result = {
            'status': 'ok',
            'message': ''
        }
        if id and username and password:
            bank = OFXHome.lookup(id)
            i = Institution(
                    id = bank['fid'],
                    org = bank['org'],
                    url = bank['url'],
                    broker_id = bank['brokerid'],
                    description = bank['name'],
                    username = username,
                    password = password
            )
            try:
                i.authenticate()
            except Exception as e:
                result['status'] = 'error'
                result['message'] = 'unable to log into bank with those credentials'

            for a in i.accounts():
                GlobalConfig.add_account(a)
            GlobalConfig.save()
        else:
            result['status'] = 'error'
            result['message'] = 'id, username, and password are all required'

        ret = json.dumps(result)
        cherrypy.response.body = ret
        if result['status'] == 'error':
            cherrypy.response.status = 400
        return ret
from ofxclient import Institution

app = Bottle(__name__)

@app.post('/transactions')
def download()
    params = json.loads(request.params.dict.keys()[0])
    account = params['account']
    password = params['password']
    days = params['days']
    
    inst = Institution(
            id = '54324',
            org = 'America First Credit Union',
            url = 'https://ofx.americafirst.com',
            username = '',
            password = ''
    )
    
    accounts = inst.accounts()[0]
    download  = a.download(days=days)
    
    return download
    

if __name__ == '__main__':
    port = int(os.environ.get('PORT', 8000))
    debug(mode=True)
    logging.basicConfig(level=logging.DEBUG)
    app.run(host='0.0.0.0', port=port, reloader=True)
Exemple #6
0
from ofxclient import Institution

inst = Institution(
    id='3101',
    org='AMEX',
    url=
    'https://online.americanexpress.com/myca/ofxdl/desktop/desktopDownload.do?request_type=nl_ofxdownload',
    username='******',
    password='******')

accounts = inst.accounts()
for a in accounts:
    # a StringIO wrapped string of the raw OFX download
    download = a.download(days=5)
    print download.read()

    # an ofxparse.Statement object
    statement = a.statement(days=5)
    print statement.balance