Closed
Description
Steps to reproduce:
from bunq.sdk.context.api_context import ApiContext
from bunq.sdk.context.api_environment_type import ApiEnvironmentType
from bunq.sdk.model.generated.object_ import Amount, NotificationFilterUrl
from bunq.sdk.http.api_client import ApiClient
from bunq.sdk.model.generated import endpoint
from bunq.sdk.context.bunq_context import BunqContext
CONTEXT_PATH = './context.ctx'
try:
context = ApiContext.restore(CONTEXT_PATH)
except Exception as e:
context = ApiContext.create(
ApiEnvironmentType.PRODUCTION,
SECRET['api_key'],
"blablabala",
all_permitted_ip=['*'],
)
context.save(CONTEXT_PATH)
BunqContext.load_api_context(context)
client = Client(context)
# just to get a monetary acc
r=endpoint.MonetaryAccount.list().value
for l in r:
print(l.MonetaryAccountBank.id_)
print(l.MonetaryAccountBank.__dict__)
id_ = l.MonetaryAccountBank.id_
break
r = endpoint.NotificationFilterUrlMonetaryAccount.create(
id_,
notification_filters=[
NotificationFilterUrl(
category='BUNQME_TAB',
notification_target='https://quwy.nl/gimmemymoney/'
)
]
)
print(r)
What should happen:
print the NotificationFilterModel
What happens:
- Throws keyerror exception 'Id'
Traceback
[{'NotificationFilterUrl': {'id': 96297678, 'created': '2020-03-11 17:29:22.491900', 'updated': '2020-03-11 17:29:22.491900', 'category': 'BUNQME_TAB', 'notification_target': 'https://quwy.nl/gimmemymoney/'}}]
Traceback (most recent call last):
File "client.py", line 61, in <module>
notification_target='https://quwy.nl/gimmemymoney/'
File "/Users/abel/Desktop/elastiek/bunq/env/lib/python3.7/site-packages/bunq/sdk/model/generated/endpoint.py", line 29106, in create
cls._process_for_id(response_raw)
File "/Users/abel/Desktop/elastiek/bunq/env/lib/python3.7/site-packages/bunq/sdk/model/core/bunq_model.py", line 77, in _process_for_id
cls._unwrap_response_single(obj, cls._FIELD_ID)
File "/Users/abel/Desktop/elastiek/bunq/env/lib/python3.7/site-packages/bunq/sdk/model/core/bunq_model.py", line 64, in _unwrap_response_single
print(obj[cls._FIELD_RESPONSE][cls._INDEX_FIRST][wrapper])
SDK version and environment
- Tested on 0.12.4
- Sandbox
- Production
aenum==2.2.3
bunq-sdk==1.13.1
certifi==2019.11.28
cffi==1.14.0
chardet==3.0.4
cryptography==2.8
idna==2.9
pycparser==2.20
pycryptodomex==3.9.7
requests==2.23.0
simplejson==3.17.0
six==1.14.0
urllib3==1.25.8
Response id
- Response id:
Extra info:
Seems to be a mismatch of cls._FIELD_ID
in the BunqModel
NotificationFilterUrlMonetaryAccount
versus the id provided in the api response. Api response contains key: 'id', whilst the cls._FIELD_ID
= 'Id' (capitalized).
Metadata
Metadata
Assignees
Labels
No labels