bunq / sdk_python Goto Github PK
View Code? Open in Web Editor NEWPython SDK for bunq API
License: MIT License
Python SDK for bunq API
License: MIT License
reference bunq/sdk_php#126
no logs
Reference bunq/sdk_php#122
no logs
There is a typo in the bunq\Model\Generated\Endpoint\SchedulePayment
class. It has the constant const OBJECT_TYPE = 'SchedulePayment';
while the API returns an object of type ScheduledPayment
. When I change the constant to this, it works fine.
PHP Notice: Undefined index: SchedulePayment in /Users/mathijs/Code/bunqapibouwsel/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php on line 115
no logs
pip3 install bunq_sdk --upgrade
test.py
which contains from bunq.sdk import context
~ $ python3 test.py
Traceback (most recent call last):
File "test.py", line 1, in <module>
from bunq.sdk import context
File "/usr/local/lib/python3.4/dist-packages/bunq/sdk/context.py", line 6, in <module>
from bunq.sdk.model import core
File "/usr/local/lib/python3.4/dist-packages/bunq/sdk/model/core.py", line 1, in <module>
from bunq.sdk import client
File "/usr/local/lib/python3.4/dist-packages/bunq/sdk/client.py", line 2, in <module>
from json import JSONDecodeError
ImportError: cannot import name 'JSONDecodeError'
needs #78
lOOKS LIKE THE generated.Payment.FIELD_COUNTERPARTY_ALIAS is not supporting IBANs for sending money
For example using
generated.Payment.FIELD_COUNTERPARTY_ALIAS: object_.Pointer(
'IBAN',
'IBAN number',
'Name'
),
The Name option looks like it is not there at all
no logs
no logs
As of now, the init function of the object_.Pointer class does not have a field for the name of e.g. a counterparty_alias, however such a name is important when making payments to IBAN numbers. One can set the name afterwards, but this is awkward especially when a Pointer is created in a request map as e.g. shown in the PaymentExample.
I suggest the following changes:
As it is now:
class Pointer(model.BunqModel):
def __init__(self, type_, value):
self.type_ = type_
self.value = value
self.name = None
My suggestion:
class Pointer(model.BunqModel):
def __init__(self, type_, value, name=None):
self.type_ = type_
self.value = value
self.name = name
Apparently an error has been made while releasing 0.13.0 to PyPI, because the PyPI package with version 0.12.4 now contains code from 0.13.0. This basically breaks everything :(
pip3 install bunq_sdk --upgrade
Line 2 in 3ba4987
from simplejson import JSONDecodeError
test.py
which contains from bunq.sdk import context
~ $ python3 test.py
Traceback (most recent call last):
File "test.py", line 1, in <module>
from bunq.sdk import context
File "/usr/local/lib/python3.4/dist-packages/bunq/sdk/context.py", line 9, in <module>
from bunq.sdk.model.generated import endpoint
File "/usr/local/lib/python3.4/dist-packages/bunq/sdk/model/generated/endpoint.py", line 3, in <module>
from bunq.sdk import context
ImportError: cannot import name 'context'
It looks like a cyclic import (`context` importing `endpoint` and `endpoint` importing `context`), but I don't know why this is a problem for python 3.4.2.
It would be nice to have the option to save the API parameters to e.g. a database instead of to the bunq.conf
file. For now, one can download the code and rewrite the saving function, or mock the saving function, either possibility is not very desirable.
sdk_python/bunq/sdk/model/generated/endpoint.py
Line 15995 in 68318f8
id
field that holds the id of this request token.id
field is missingno logs
BunqResponse
object which, besides the response model, includes the response headers and pagination_
no logs
BunqModel
to_json
no logs
ensureSesiosActive()
api_context.ensure_session_active()
api_context.save(filename_bunq_config_full)
Which means you will be saving an unchanged context on each call
It would be very handy if you could package this SDK and put it on PyPi so that it can easily be integrated into e.g. requirements.txt and I don't have to copy & paste the source code if I want to use the SDK.
Instructions on how to submit this as a package can be found here
This issue is meant to keep track of the example scripts included in the SDK.
ApiContext
Attachments
Callbacks
Cards
Card payments
Cash registers
Chat
Connects
Export statements
Invoices
Monetary accounts
Payment
Request for payment / Request inquiry
User
no logs
Your functionality on de- & serialising (especially nested) JSON data to Python classes is pretty neat and actually high in demand in the Python community at the moment.
Until now, JSONPickle is mostly the library of choice when de/serialising nested JSON data from and to Python objects, but "pickled" JSON Data (with Pickle serialised Python Objects) can only be deserialised with the same methods as with which they were serialised. Therefore, nested JSON data received from somewhere else cannot be deserialised without knowing how it was serialised.
Your JSONAdapter class seems to be able to do just that without knowing how the data was serialised. Given the need for such functionality in the Python community, I'd like to propose that you extract this functionality into a separate library and preferably put it on PyPi.
id
, created
or updated
from CardGeneratedCvc2
no logs
Reference: bunq/sdk_php#120
Hello! It's me again!
I encountered a problem when making calls with the SDK in a concurrent manner. Especially, I got the following error when making calls to the production API (no errors occurred in Sandbox)
Here's the stacktrace:
# Making a call with a ApiContext to the User object. I deleted calls in my own code.
users = generated.User.list(api.Client.ctx())
File "/usr/lib/python3.6/site-packages/bunq/sdk/model/generated/endpoint.py", line 9480, in list
response = api_client.get(endpoint_url, custom_headers)
File "/usr/lib/python3.6/site-packages/bunq/sdk/client.py", line 246, in get
custom_headers
File "/usr/lib/python3.6/site-packages/bunq/sdk/client.py", line 109, in _request
response.headers
File "/usr/lib/python3.6/site-packages/bunq/sdk/security.py", line 250, in validate_response
signer.verify(digest, base64.b64decode(headers[_HEADER_SERVER_SIGNATURE]))
File "/usr/lib/python3.6/site-packages/requests/structures.py", line 54, in __getitem__
return self._store[key.lower()][1]
KeyError: 'x-bunq-server-signature'
Do you have an idea what could cause the problem that out of a sudden the server signature is not found anymore when making concurrent calls and no problem occurs when making sequential calls?
Update: I experienced this issue whenever I create 2 Threads which create and 'get' Payments to the production API. So basically, I make 2 independent Payments from e.g. account A to C and account B to C and then there seems to be some kind of issue with the verification function of the bunq response
Test
)TestApiContext
is located in Model/Generated
AvatarTest
.gitattributes
file which lists generated code as generated..gitattributes
file.ApiContext
ApiContext
Is it possible to ad a callback code sample.
The webserver i can configure my self etc but love to have a sample on how to setup the callback so for example when a pin or other transaction happens i can react on it.
Not an issue just a request :-)
response.value
has a strict type in docstring, and the IDE auto-completion works on itresponse.value
doesn't have a strict type in docstring and therefore IDE auto-completion doesn't work on it no logs
needs #78
$callbackModel = NotificationUrl::fromJson($CallbackJson);
$callbackModel->getReferencedObject();
if (!$callbackModel isntanceof CallbackModelImExcpeting) {
throw new Exception();
}
no logs
MasterCardAction
endpoint.no logs
I heard from @OGKevin that pagination of payment lists does not work yet, but I wanted to ask whether you maybe have a temporary workaround for that?
I thought about maybe using the Payment ID, but I'm not sure whether that ID is specific per user (i.e. increases by 1 whenever the user makes a payment, independently of the actions of other users) or global (increases whenever any user makes a payment).
Do you maybe have an idea of a workaround in mind?
The purpose of this issue is to introduce https://zappr.opensource.zalan.do so that quality control on pull requests can be assured.
The following configuration should be used:
autobranch:
pattern: 'bunq/sdk_python#{number}-{title}'
length: 100
commit:
message:
patterns:
- '([A-Za-z0-9 ]+)\. (\(bunq\/sdk_python#[0-9]+\))'
specification:
title:
minimum-length:
enabled: true
length: 8
body:
minimum-length:
enabled: true
length: 8
contains-url: true
contains-issue-number: true
template:
differs-from-body: true
pull-request:
labels:
additional: true
required:
- Reviewed by André
- Can be merged
Hey Guys!
Awesome work on the API. Been playing around with it for a while now and thought now was the time to get into automated payments.
When doing this I ran into to the problem of transfering money to myself. The only way I found that would work, is to transfer it to the iban of the account I wanted it in.
So i started with the payment requestmap, like the example:
request_map = {
generated.Payment.FIELD_AMOUNT: object_.Amount(
str(pin_saving_amount),
'EUR'
),
generated.Payment.FIELD_COUNTERPARTY_ALIAS: object_.Pointer(
'IBAN',
'NL13BUNQ3713371337'
),
generated.Payment.FIELD_DESCRIPTION: 'Pinsparen {}'.format(yesterday),
}
This bounded when creating the payment, because the name field was not set. Now i thought this was an error on my end, but looking in the SDK code I came across the reason didn't see it coming in the first place. Note that the api docs state this is needed, so I could have used my eyes to start with 😇 .
class Pointer(model.BunqModel):
"""
:type type_: str
:type value: str
:type name: str
"""
def __init__(self, type_, value):
"""
:type type_: str
:type value: str
"""
self.type_ = type_
self.value = value
self.name = None
This is a piece of code from:
As can be seen the name object is None by default and not set-able on init, which would make sense to do if you'd like to enforce people to use it in some cases.
Since this code is in the "generated" directory i didn't start creating a PR already, because i would like to verify if that would be a 'good move' or this is something that had to be done on bunq's side for generating the code.
Anyway, the following code would make a good replacement:
class Pointer(model.BunqModel):
"""
:type type_: str
:type value: str
:type name: str
"""
def __init__(self, type_, value, name=None):
"""
:type type_: str
:type value: str
:type name: str
"""
self.type_ = type_
self.value = value
self.name = name
This way name will be None by default, but at least set-able at creation 🙂
TokenQrRequestIdeal
using the SDK.TokenQrRequestIdeal
object is returned.RequestResponse
object, but the SDK tries to cast it to a TokenQrRequestIdeal
, resulting in an error.createFromJsonString
No logs
X-Bunq-Server-Response-Id
header.logs
Tested
check box and says which issue the PR will close.no logs
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.