yapily / yapily-sdk-python

Python SDK generated against the Yapily API. This SDK can be used to connect to Open Banking entities.
https://yapily.com
MIT License
13 stars 10 forks source link
devtools finance financial-institutions fintech-utility oauth2 openapi-generator openapi3 openbanking openbanking-sdk psd2 python python-sdk sdk sdk-python yapily yapily-api yapily-sdk

Yapily Python SDK

GitHub version

This SDK library was generated using OpenApi Generator. The SDK can be used as a module in your code and the examples demonstrate how to connect to financial institutions integrated with Yapily.

Requirements

To connect to the Yapily API, you will need to register your application at [https://dashboard.yapily.com]().

These application credentials can then be used to authorise all your API requests.

Installation

The SDK is currently available in the Yapily github repository and can be included in your project by adding it to your dependencies

pip install

pip3 install git+https://github.com/yapily/yapily-sdk-python.git#subdirectory=sdk

pip upgrade

pip3 install --upgrade git+https://github.com/yapily/yapily-sdk-python.git#subdirectory=sdk

Usage

Sample usage of the SDK can be seen in the examples folder.

configuration = Configuration()
configuration.username = constants.APPLICATION_ID
configuration.password = constants.APPLICATION_SECRET

apiClient = ApiClient(configuration)
institutionsApi = InstitutionsApi(apiClient)
institutions = institutionsApi.get_institutions_using_get()
account_authorisation_request = AccountAuthorisationRequest(
    application_user_id=constants.APPLICATION_USER_ID, 
    institution_id=constants.INSTITUTION_ID,
    callback='',
    one_time_token=''
)

response = accounts_api.initiate_account_request_using_post(account_auth_request=account_authorisation_request)
redirect_url = response.data.authorisation_url
def filterByStatus(consent):
    if (consent.status == "AUTHORIZED"):
        return True
    else:
        return False

consents = ConsentsApi(apiClient).get_consents_using_get(
    filter_application_user_id=[constants.APPLICATION_USER_ID],
    filter_institution=[constants.INSTITUTION_ID]
).data

authorised_consents = list(filter(filterByStatus, consents))
consent = authorised_consents[0]
consent_token = consent.consent_token
transactionsApi = TransactionsApi(apiClient)
transactions = transactionsApi.get_transactions_using_get(consent_token, accounts.data[0]._id)

Further information

For more information on how to get connected, visit the Yapily Knowledge Base.