karlicoss / monzoexport

Tool to export your Monzo transactions
MIT License
4 stars 0 forks source link

Something went wrong #5

Closed rmlhuk closed 8 months ago

rmlhuk commented 4 years ago

The export starts but fails after around 10 minutes, I feel like there's some sort of timeout going on. The first-time json isn't being generated.

Token should be saved on disk now (you won't need to relogin anymore) Traceback (most recent call last): File "./export.py", line 150, in main() File "./export.py", line 141, in main j = get_json(params, first_time=first_time) File "./export.py", line 61, in get_json return Exporter(params).export_json() File "./export.py", line 55, in export_json adata['data'] = self._get_account_data(account_id=aid) File "./export.py", line 36, in _get_account_data 'since' : since, File "/usr/local/lib/python3.7/site-packages/pymonzo/monzo_api.py", line 226, in _get_response "Something went wrong: {}".format(response.json()) pymonzo.exceptions.MonzoAPIError: Something went wrong: {'code': 'forbidden.verification_required', 'message': 'Verification required', 'params': {'account_id': '**', 'auth_session_id': '', 'client_id': '', 'end_time': '', 'start_time': '', 'user_id': ''}}

karlicoss commented 4 years ago

Hi @rmlhhd Does it reproduce every time? Timeout is weird, since the exception says something about the verification...

rmlhuk commented 4 years ago

Hi @karlicoss

Yes, this happens everytime. I complete all the vertification steps and click approve within the Monzo App. The script then seems to run and after say 10 minutes it fails with this error.

karlicoss commented 4 years ago

Btw, last night monzo has expired my token for no apparently reason, so I had to repeat this myself; and I did notice that the --first-time export takes a while (although it did succeed for me). I wonder if it's possible that the export takes longer than five minutes, so the token expires during the export.

I wonder, if you try running the script wihout --first-time (assuming you use the same token, it should be saved despite the tool crashing), do you get any results? If yes, that would probably confirm my hypothesis, and also mean there needs to be a more elaborate algorithm for --first-time export, e.g. try to retrieve as much as we can, on veritfication error, prompt the user to authorise again; until we export everything. A bit annoying, but hopefully you only need to do this once.