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'}
... )

Stop Playwright gracefully when you're done:

>>> ubank_client.stop()

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.

Release

Bump project version. e.g.,

$ poetry version patch
Bumping version from 0.1.1 to 0.1.2

Publish to PyPI:

$ read -s PASSWORD
$ poetry publish --build -u __token__ -p "$PASSWORD"

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.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

ubank-0.1.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ubank-0.1.2.tar.gz
  • Upload date:
  • Size: 4.0 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.2.tar.gz
Algorithm Hash digest
SHA256 2dc3e24d808f8abcac746778fda1c1b2a0037acd95eecadce9d7e3d0819073eb
MD5 0471d89d8748aec6993ad01919bed282
BLAKE2b-256 4c4f42492e1172a0933b11f7d93b80d42084ded3c1d372abf9acaa9c801d4241

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ubank-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.5 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7ae553ca55205f0067218fa2c165184d26704364559b519d5632b58985e56556
MD5 4e49b5daeae2eeb69ab89e0ca98cd6c4
BLAKE2b-256 b65be13a7725cd2535aa821d84587871a4272767dcb60c32f68419e66f295566

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