Skip to content

Instantly share code, notes, and snippets.

@basst85
Created October 17, 2019 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save basst85/c52f70c82ecdbb326867470b7ca4a60a to your computer and use it in GitHub Desktop.
Save basst85/c52f70c82ecdbb326867470b7ca4a60a to your computer and use it in GitHub Desktop.
bunq_events_list.py
#!/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 sandbox API key'
_DEVICE_DESCRIPTION = 'TestPython'
_CONFIG_FILE_LOCATION = 'bunq_sandbox.conf'
_MONETARY_ACCOUNT = '123456' # Replace with one of your monetary account id's
def run():
# Run once and then comment
ApiContext(
ApiEnvironmentType.SANDBOX,
_API_KEY,
_DEVICE_DESCRIPTION).save(_CONFIG_FILE_LOCATION)
# Run always
api_context = ApiContext.restore(_CONFIG_FILE_LOCATION)
api_context.ensure_session_active()
api_context.save(_CONFIG_FILE_LOCATION)
BunqContext.load_api_context(api_context)
events_list = endpoint.Event.list(
params={'monetary_account_id':_MONETARY_ACCOUNT, 'display_user_event':'false'})
for event in events_list.value:
if event.object_.MasterCardAction:
# List the descriptions of the card payments
print(event.object_.MasterCardAction.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