Skip to main content

BAM-Lib

A python library that makes it easy to utilize the bank-account-microservice microservice.

bank-account-microservice on:
heroku
github

Important note: The free heroku service I'm using shuts the server down after 30 minutes of no use. Your first call to the server will likely be slow due to this. If you click the heroku link above you can start the server up before you utilize the library

For now your best bet is just to copy/paste this functionality into a .py file to test it out... I'm working on fixing that.

git clone https://github.com/blarmon/BAM-Lib

Using this library:

Available functions

  • get_account()

    • Called with no parameters this function will return all accounts. Given an account id it will return only that account.

    CALL: print(get_account())
    OUTPUT:

 [{'id': 5, 'customer': 1, 'account_type': 'savings', 'balance': '1234.56', 'interest_rate': '2.76', 'account_opened': '2018-12-  29T17:50:20.862829Z'}, {'id': 6, 'customer': 1, 'account_type': 'savings', 'balance': '1234.56', 'interest_rate': '2.76', 'account_opened': '2018-12-29T17:57:35.778662Z'}, {'id': 7, 'customer': 1, 'account_type': 'savings', 'balance': '876543.21', 'interest_rate': '2.76', 'account_opened': '2018-12-29T17:58:06.781378Z'}, {'id': 8, 'customer': 1, 'account_type': 'savings', 'balance': '1234.56', 'interest_rate': '2.76', 'account_opened': '2018-12-29T17:50:20.862829Z'}, {'id': 4, 'customer': 1, 'account_type': 'money market', 'balance': '956.00', 'interest_rate': '5.00', 'account_opened': '2018-12-28T20:35:54.186979Z'}]  
  • get_user()

    • Called with no parameters this function will return all accounts. Given an account id it will return only that account.

    CALL: print(get_user())
    OUTPUT:

 [{'url': 'https://bank-account-microservice.herokuapp.com/api/users/4/', 'username': 'csiegel42', 'email': 'chris@chris.chris', 'accounts': []}, {'url': 'https://bank-account-microservice.herokuapp.com/api/users/3/', 'username': 'different_name', 'email': 'chris@chris.chris', 'accounts': []}, {'url': 'https://bank-account-microservice.herokuapp.com/api/users/1/', 'username': 'csiegel', 'email': 'christopher.siegel@dmu.edu', 'accounts': ['https://bank-account-microservice.herokuapp.com/api/accounts/4/', 'https://bank-account-microservice.herokuapp.com/api/accounts/5/', 'https://bank-account-microservice.herokuapp.com/api/accounts/6/', 'https://bank-account-microservice.herokuapp.com/api/accounts/7/', 'https://bank-account-microservice.herokuapp.com/api/accounts/8/']}]
  • delete_account()

    • Accepts an account id as a parameter and deletes that account.

    CALL: print(delete_account(5))
    OUTPUT:

 <Response [204]>
  • delete_user()

    • Accepts a user id as a parameter and deletes that user.

    CALL: print(delete_user(4))
    OUTPUT:

  <Response [204]>
  • create_account()

    • Creates a new account. 5 paramaters are accepted: customer_id (number), account_type (string), balance (number), interest_rate (number), and account_opened (datetime). All are required, except for account_opened, which will default to datetime.now().

    CALL: print(create_account(customer_id=1,account_type='savings', balance=4500, interest_rate=2.55))
    OUTPUT:

{'id': 10, 'customer': 1, 'account_type': 'savings', 'balance': '4500.00', 'interest_rate': '2.55', 'account_opened': '2018-12-31T09:58:54.183647Z'}
  • create_user()

    • Creates a new user. Parameters "username" and "email" are both strings, and are both required. The given username and email must pass all validation requirements for usernames and emails.

    CALL: print(create_user(username='sample_user', email='sample@user.net'))
    OUTPUT:

{'url': 'https://bank-account-microservice.herokuapp.com/api/users/6/', 'username': 'sample_user', 'email': 'sample@user.net', 'accounts': []}
  • modify_account()

    • Modifies an existing account. The first parameter given is the id of the account you wish to modify. All of the parameters given in create_account() are modifiable. If a new value is not specified in the parameter list then that value will not be modified.

    CALL: print(modify_account(10, account_type='checking', interest_rate=3.8))
    OUTPUT:

<Response [200]>
  • modify_user()

    • Modifies an existing user. The first parameter given is the id of the user you wish to modify. All of the parameters given in create_user() are modifiable. If a new value is not specified in the parameter list then that value will not be modified.

    CALL: print(modify_user(6, username='sample_user_modified', email='sample@user.modified'))
    OUTPUT:

 <Response [200]>  

Metadata

Release files for thebamlib 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for thebamlib 0.0.1
File Size Uploaded
thebamlib-0.0.1.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for thebamlib 0.0.1
File Interpreter ABI Platform
thebamlib-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.2 kB

Release files / thebamlib-0.0.1.tar.gz

Download URL thebamlib-0.0.1.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
45fa39555f9af80a4abc5060b5f6669fe31ce4e0a6423cbacc57bf5ab88f8c86
BLAKE2b-256 checksum
How to use checksums
86b7c7da8fb24fe8bc8db167dd8848329347b5f8db3b8f2a2e554d9e2f7760f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

Release files / thebamlib-0.0.1-py3-none-any.whl

Download URL thebamlib-0.0.1-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c212a9def41ed084009e1315fce527f35385f1cae3de9a730a8c3f517748892f
BLAKE2b-256 checksum
How to use checksums
eb38595897787f2f1b55cddc47d02309f1f9bf54b7529bb3775a86d7391e1f3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page