Skip to main content

Access ubank programatically.

Project description

ubank

Access ubank programatically.

This does not provide true API-like interface, but you can retrieve information using browser automation.

Requirements

Python 3.8+ and Playwright.

Installation

Install from PyPI:

$ pip install ubank

Install version of Firefox required by Playwright:

$ playwright install --with-deps firefox

Getting started

Create an instance of UbankClient and log in using a security code:

>>> from ubank import UbankClient
>>> ubank_client = UbankClient()
>>> ubank_client.log_in_with_security_code('name@domain.com', 'SecretPassw0rd')
Enter security code: 123456

Then you can get account information:

>>> ubank_client.get_accounts()
{'linkedBanks': [{'bankId': 1, 'shortBankName': 'ubank', 'accounts': [{'label': 'Spend account', 'nickname': 'Spend account', 'type': 'TRANSACTION', 'balance': {'currency': 'AUD', 'current': 1000, 'available': 1000}, 'status': 'Active'}, {'label': 'Save account', 'nickname': 'Save account', 'type': 'SAVINGS', 'balance': {'currency': 'AUD', 'current': 10000, 'available': 10000}, 'status': 'Active'}]}]}

After logging in with a security code, you can retrieve a trusted cookie:

>>> ubank_client.get_trusted_cookie()
{'name': '026d9560-3c86-4680-b926-44bdd28eba94', 'value': 'YmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFo', 'domain': 'www.ubank.com.au', 'path': '/', 'expires': 1706758407, 'httpOnly': True, 'secure': True, 'sameSite': 'Strict'}

Use the cookie to log in without a security code:

>>> ubank_client.log_in_with_trusted_cookie(
...     'name@domain.com',
...     'SecretPassw0rd',
...     {'name': '026d9560-3c86-4680-b926-44bdd28eba94', 'value': 'YmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFo', 'domain': 'www.ubank.com.au', 'path': '/', 'expires': 1706758407, 'httpOnly': True, 'secure': True, 'sameSite': 'Strict'}
... )

You can also retrieve a trusted cookie by running the ubank module from the command line. Use an environment variable to avoid storing your banking password in shell history:

$ read -s PASSWORD
SecretPassw0rd

Running ubank as a module will prompt for a security code and then display the trusted cookie object:

$ python -m ubank name@domain.com "$PASSWORD"
Enter security code: 123456
{'name': '026d9560-3c86-4680-b926-44bdd28eba94', 'value': 'YmxhaCBibGFoIGJsYWggYmxhaCBibGFoIGJsYWggYmxhaCBibGFo', 'domain': 'www.ubank.com.au', 'path': '/', 'expires': 1706758407, 'httpOnly': True, 'secure': True, 'sameSite': 'Strict'}

Secure storage of your username, password and trusted cookie is your responsibility.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ubank-0.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

ubank-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file ubank-0.1.0.tar.gz.

File metadata

  • Download URL: ubank-0.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.1 Darwin/22.5.0

File hashes

Hashes for ubank-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bd7c0006f85f00a85c56502e6206f048f5ba8ccd415b38274b37b4007b4ec414
MD5 3970fe00024ec4cc51782975d7b505f8
BLAKE2b-256 14476368193c923ffad15c755363a662326b97fd44b8a1c82e3ba0c1e578b82b

See more details on using hashes here.

File details

Details for the file ubank-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ubank-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.1 Darwin/22.5.0

File hashes

Hashes for ubank-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b41ef8c2e46f3a6d3a71db9aae0558d1a2373f75e7e73c1ae9ee8734712f5f1e
MD5 d555aeeff6c1f416b524a4064756e4d7
BLAKE2b-256 8e42e37d47a6d4e6edce1ea2d9441a17f3fcc1da4abf01918a7d2380f2c2a9b1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page