Created
April 18, 2018 07:55
-
-
Save basst85/498ef4de60efcbfe2b5e7d5ac0f5132a to your computer and use it in GitHub Desktop.
bunq Python SDK example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import warnings | |
from bunq.sdk import context | |
from bunq.sdk.json import converter | |
from bunq.sdk.client import Pagination | |
from bunq.sdk.context import ApiContext | |
from bunq.sdk.context import ApiEnvironmentType | |
from bunq.sdk.context import BunqContext | |
from bunq.sdk.model.generated import endpoint | |
warnings.filterwarnings("ignore") | |
_API_KEY = 'Your bunq API key' | |
_DEVICE_DESCRIPTION = 'TestPython' | |
_CONFIG_FILE_LOCATION = '/usr/local/development/bunq_sandbox.conf' | |
def run(): | |
ApiContext( | |
ApiEnvironmentType.SANDBOX, | |
_API_KEY, | |
_DEVICE_DESCRIPTION).save(_CONFIG_FILE_LOCATION) | |
api_context = ApiContext.restore(_CONFIG_FILE_LOCATION) | |
api_context.ensure_session_active() | |
api_context.save(_CONFIG_FILE_LOCATION) | |
BunqContext.load_api_context(api_context) | |
pagination = Pagination() | |
pagination.count = 50 | |
payments_list = endpoint.Payment.list( | |
params=pagination.url_params_count_only) | |
for payment in payments_list.value: | |
print(payment.id_,payment.description) | |
# Run it only if called from the command line | |
if __name__ == '__main__': | |
run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment