You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...
File "/app/export.py", line 44, in <genexpr>
self.api.transaction(t['id'], expand_merchant=True)._raw_data
File "/usr/local/lib/python3.8/site-packages/pymonzo/monzo_api.py", line 398, in transaction
return MonzoTransaction(data=response.json()['transaction'])
File "/usr/local/lib/python3.8/site-packages/pymonzo/api_objects.py", line 42, in __init__
self._parse_special_fields(data_copy)
File "/usr/local/lib/python3.8/site-packages/pymonzo/api_objects.py", line 117, in _parse_special_fields
self.merchant = MonzoMerchant(data=data.pop('merchant'))
File "/usr/local/lib/python3.8/site-packages/pymonzo/api_objects.py", line 33, in __init__
raise ValueError(
ValueError: Passed data doesn't have all required keys (missing keys: created)
More debugging:
DEBUG:requests_oauthlib.oauth2_session:Passing through key word arguments {'params': {'expand[]': 'merchant'}, 'allow_redirects': True}.
DEBUG:urllib3.connectionpool:https://api.monzo.com:443 "GET /transactions/tx_XXXXXXXXXXXXXXX?expand%5B%5D=merchant HTTP/1.1" 200 None
I tried monkey patching it with the following snippet:
M_keys = MonzoMerchant._required_keys
if 'created' in M_keys:
M_keys.remove('created')
But sadly this fails with, so seems created is hardcoded in pymonzo code
File "/usr/local/lib/python3.8/site-packages/pymonzo/api_objects.py", line 117, in _parse_special_fields
self.merchant = MonzoMerchant(data=data.pop('merchant'))
File "/usr/local/lib/python3.8/site-packages/pymonzo/api_objects.py", line 42, in __init__
self._parse_special_fields(data_copy)
File "/usr/local/lib/python3.8/site-packages/pymonzo/api_objects.py", line 136, in _parse_special_fields
self.created = parse_date(data.pop('created'))
KeyError: 'created`
So I think for now, for my monzoexport, I'll just use the raw __get_response method. But let me know if you're interested in a proper fix, I might come up with some PR. Thanks!
The text was updated successfully, but these errors were encountered:
karlicoss
added a commit
to karlicoss/monzoexport
that referenced
this issue
Mar 16, 2022
First of all, sorry for replying so late. The library was essential not supported since ~2017. I had some free time recently though and decided to give it some love and release v1.0.0
I tried reproducing the error, and I think it’s fixed. I’m gonna close the issue, but let me know if it still errors out.
pymonzo version:
v0.11.0
(latest)This started happening for me since 15.03.2022:
Stacktrace:
More debugging:
So merchant creation date is missing from the payload. I couldn't find API docs for merchants, so not sure if it's just not passed by the API now
Possibly related: monzo/docs#71
I tried monkey patching it with the following snippet:
But sadly this fails with, so seems
created
is hardcoded in pymonzo codeSo I think for now, for my monzoexport, I'll just use the raw
__get_response
method. But let me know if you're interested in a proper fix, I might come up with some PR. Thanks!The text was updated successfully, but these errors were encountered: