一个python库,它使利用银行帐户微服务微服务变得容易。

thebamlib的Python项目详细描述


BAM库

一个python库,它使利用银行帐户微服务微服务变得容易。

银行帐户微服务于:
heroku
github

重要提示:我使用的免费heroku服务在30分钟没有使用后关闭服务器。因此,您第一次呼叫服务器的速度可能会很慢。如果单击上面的heroku链接,可以在使用库之前启动服务器

目前,您最好的选择是将此功能复制/粘贴到.py文件中以进行测试…我正在努力修理它。< EH3>

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

使用此库:

可用功能

  • 获取帐户()

    • 不带参数调用此函数将返回所有帐户。给定一个帐户ID,它将只返回该帐户。

    呼叫: print(get_account())
    输出:

 [{'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'}]  
  • 获取用户()

    • 不带参数调用此函数将返回所有帐户。给定一个帐户ID,它将只返回该帐户。

    呼叫: print(get_user())
    输出:

 [{'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/']}]
  • 删除帐户()

    • 接受帐户ID作为参数并删除该帐户。

    呼叫: print(delete_account(5))
    输出:

 <Response [204]>
  • 删除用户()

    • 接受用户id作为参数并删除该用户。

    呼叫: print(delete_user(4))
    输出:

  <Response [204]>
  • 创建帐户()

    • 创建新帐户。接受5个参数:客户ID(编号)、账户类型(字符串)、余额(编号)、利率(编号)和开户账户(日期时间)。所有这些都是必需的,除了帐户已打开(默认为datetime.now())。

    呼叫: print(create_account(customer_id=1,account_type='savings', balance=4500, interest_rate=2.55))
    输出:

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

    • 创建新用户。参数“username”和“email”都是字符串,都是必需的。给定的用户名和电子邮件必须通过用户名和电子邮件的所有验证要求。

    呼叫: print(create_user(username='sample_user', email='sample@user.net'))
    输出:

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

      修改现有帐户。给出的第一个参数是要修改的帐户的ID。create_account()中给出的所有参数都是可修改的。如果参数列表中未指定新值,则不会修改该值。

    呼叫: print(modify_account(10, account_type='checking', interest_rate=3.8))
    输出:

<Response [200]>
  • 修改用户()

      修改现有用户。给出的第一个参数是要修改的用户的id。create_user()中给出的所有参数都是可修改的。如果参数列表中未指定新值,则不会修改该值。

    呼叫: print(modify_user(6, username='sample_user_modified', email='sample@user.modified'))
    输出:

 <Response [200]>  

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
带验证的java JavaScript链接生成器   java休眠外键而不是实体   使用正则表达式在java中分隔字符串的数组   爪哇/sdk/platformtools/adb,startserver失败   可以使用java URL连接通过Id获取html   java使用Maven构建类路径失败   java GUI最初未显示(netbeans)   java无法解析:com。安卓支持:supportv4:26.0.2   swing覆盖Java DefaultStyledDocument实现   JAVAlang.IllegalState异常LifeCycleCProcessor和ApplicationEventMulticaster在使用Spring引导时未初始化   JAXB Websphere jar与applicationl jar的java ClassCastException   继承获取父子类java的不兼容错误