def fetch(config, fileobj):
"""
Fetch transactions for the Visa card specified in the config.
We start by logging in to fidelity.com, then click through some menus to
transfer credentials to Elan Financial Services' site fidelityrewards.com,
where we download transactions for the past 17-18 months in CSV format.
"""
*_, lastfour = config
account_name = f'Fidelity Visa {lastfour.value}'
fileobj.write(account_name + '\n')
with tempfile.TemporaryDirectory() as tempdir:
csv_path, balance = _download(config, tempdir)
fileobj.write(balance + '\n')
with open(csv_path, 'r') as csv_file:
shutil.copyfileobj(csv_file, fileobj)
评论列表
文章目录