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.

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

Uploaded Source

Built Distribution

ubank-0.1.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ubank-0.1.1.tar.gz
  • Upload date:
  • Size: 3.9 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.1.tar.gz
Algorithm Hash digest
SHA256 c9692964c5ac665eeca24f174871118af8df0011cad2aa53caf807d5a2e876de
MD5 e474ad3d5ccf2b82a555a751d95a7948
BLAKE2b-256 a6bb8e6d4ea5014e8a3be6ac5d41319d577d23e98601f3b3e14f48603556bf3f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ubank-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8ac933f3f85ff02ea201e4e9e2f585d11f2b2a809d5a5da70476be68291039c7
MD5 1378a2bfb7687aef6fcebe6ba8161334
BLAKE2b-256 55349189f13f7100276e164cfe5870bedaaa8eaa72c1038be009ac916e7b842f

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