Skip to main content

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

Project description

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]>  

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

thebamlib-0.0.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

thebamlib-0.0.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file thebamlib-0.0.1.tar.gz.

File metadata

  • Download URL: thebamlib-0.0.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for thebamlib-0.0.1.tar.gz
Algorithm Hash digest
SHA256 45fa39555f9af80a4abc5060b5f6669fe31ce4e0a6423cbacc57bf5ab88f8c86
MD5 b59a3e6f891d5734ec470c5282268cbe
BLAKE2b-256 86b7c7da8fb24fe8bc8db167dd8848329347b5f8db3b8f2a2e554d9e2f7760f0

See more details on using hashes here.

File details

Details for the file thebamlib-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: thebamlib-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for thebamlib-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c212a9def41ed084009e1315fce527f35385f1cae3de9a730a8c3f517748892f
MD5 8f915b49d97de96311d3ccaa2b2b8882
BLAKE2b-256 eb38595897787f2f1b55cddc47d02309f1f9bf54b7529bb3775a86d7391e1f3b

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