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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: bamlib-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 bamlib-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f51217d37ae2773c93d6f188858e0d2cdc45463e932e4f6120826fce9792c7d7
MD5 1e6ba9b804fd408fb66a3f2c676c0956
BLAKE2b-256 8e0b51b6d54b0241949d6862467569179f422ad9d1fbb0dd635ba8de8b1d184e

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