Closed CharlPels closed 6 years ago
Closing this issue as its not an bug.
Please see: https://github.com/bunq/tinker_python/blob/3898543198df8c5a496fdb35dd70c994c556b102/tinker/libs/bunq_lib.py#L69-L73 for example on how to load the api context.
Hello,
It looks like an issue, your sample has the same issue the loading of the context is no issue, using it gives problems simple commands like this endpoint.User.list(api_context).value are not working anymore.
tested your sample and the examples from github
for storing i user this (from this github) https://github.com/bunq/sdk_python/blob/develop/examples/api_context_save_example.py
then use something like this https://github.com/bunq/sdk_python/blob/develop/examples/user_list_example.py
and you will get the same error this are the basic samples, just copy/paste using production keys and calling the function
These examples are outdated. see #84.
You must load the Api context before using it as shown here: https://github.com/bunq/tinker_python/blob/3898543198df8c5a496fdb35dd70c994c556b102/tinker/libs/bunq_lib.py#L69-L73
endpoint.User.list(api_context)
is not a valid function call. see the code: https://github.com/bunq/sdk_python/blob/25c6e353dfcefedfd4e1cd01e6cea529c710e7ef/bunq/sdk/model/generated/endpoint.py#L14895-L14904
Hello OGKevin,
Maybe a stupid question but why are the examples not updated?
I see the code api_context = ApiContext.restore(self.determine_bunq_conf_filename()) api_context.ensure_session_active() api_context.save(self.determine_bunq_conf_filename()) BunqContext.load_api_context(api_context) and have no clue how to use this in my code
I am not a fulltime developer :-)
Had no issue with my code using older sdk, with new sdk it stops working
you have updated from 0.12.5
to 0.13.0
this means a breaking update 😉 as the major version number has changed.
after you have ran BunqContext.load_api_context(api_context)
you can preform calls without having to pass api context. e.g. https://github.com/bunq/tinker_python/blob/2182b8be276fda921657ad22cfe0b8b48a585ccf/tinker/libs/bunq_lib.py#L105-L115
Maybe a stupid question but why are the examples not updated?
because they were examples and not essential to the release and therefore forgotten. Hence examples will be replaced with tinker as tinker contains enough "example code".
Kevin,
Can you provide an actual working running sample I can use as a starting point, not pointing to parts of this class but a actual sample I could run to for example read transactions, sending money or something. For the developers like me that don’t program all day and just want to use the api just for some basic automation
Regards, Charl
Steps to reproduce:
def register(): ctx = context.ApiContext( context.ApiEnvironmentType.PRODUCTION, "",'
)
'
register()
using a simple like this one https://github.com/bunq/sdk_python/blob/develop/examples/customer_statement_export_example.py#L24 line 24: api_context = context.ApiContext.restore() works with no issue and I see context info line 25: user_id = endpoint.User.list(api_context).value[_INDEXFIRST]\ .UserCompany.id
here you get the error bunq.sdk.exception.BunqException: ApiContext has not been loaded. Please load ApiContext in BunqContext
What should happen:
What happens:
Traceback
SDK version and environment
Response id
Extra info:
Had no issue with my code using older sdk, with new sdk it stops working