一种用于BUNQ API的SDK,通过它可以以简单的方式进行所有HTTP请求。
bunq-api-sdk的Python项目详细描述
这个项目的目标是为Bunq API提供一个完整的python包装器。它的灵感来自于伟大的 MLowijs。一些功能,特别是 in ApiClient,基于或取自 MadEddie。谢谢Mlowijs和Madeddie!
这个项目是在python 3.6中构建的
如果您已经遵循了上面提到的脚本get_started.py,
您应该将以下参数保存在某处: 注意:如果将这些参数保存到配置文件中,它们将位于
apiwrapper/config/parameters.ini 如果您有上述参数,可以继续创建
apiclient,它是bunq api的连接器。 你必须决定使用哪种apiclient。现在,我
包含一个使用配置文件的
apiwrapper/config/parameters.ini,这是“普通”类
APIClient。另外,根据奥格凯文的要求,我还包括了一个APIClient,
它不会从配置文件加载参数,该文件名为
APIClientNonPersisting。 因此,决定是否使用配置文件,并取消对
以下几行: 如果要使用存储在
apiwrapper/config/parameters.ini,使用以下代码: 否则,如果要使用自己的参数,请使用以下行
然后在那里输入参数 现在,您可以使用
EndpointsController。我已经包括了一个如何获得
API中的用户ID: Bunq API的每个端点都有自己的端点
Endpoint模块。现有的是在
apiwrapper/endpoints包。中的endpointcontroller
apiwrapper/endpoints/controller中的每一个都有一个实例
终点。任何apiclient都将具有此端点的实例
控制器调用了endpoints。创建apiclient之后,您可以
只需使用: endpoint函数只是从bunq api返回响应。 如果您想贡献,请分叉此存储库并开始实现
以下要点之一:*添加POST、PUT和一些
DELETE调用所有终结点*添加加密/解密
/config/parameter.ini使用密码的文件*查看
此存储库的问题开始
重复使用安装
fromapiwrapper.clients.api_client_persistingimportApiClientPersistingapi_key="YOUR API KEY HERE"api=ApiClientPersisting(api_key)
fromapiwrapper.clients.api_clientimportApiClientapi_key="YOUR API KEY HERE"private_key="YOUR PRIVATE KEY HERE"session_token="YOUR SESSION TOKEN HERE"server_public_key="THE SERVER PUBLIC KEY HERE"api=ApiClient(api_key,privkey=private_key,session_token=session_token,server_pubkey=server_public_key)
fromapiwrapper.clients.api_clientimportApiClientfromapiwrapper.clients.api_client_persistingimportApiClientPersistingimportjsonapi="MAKE SURE TO CREATE THE API CLIENT AS DESCRIBED ABOVE"res=api.endpoints.user.get_logged_in_user()print(json.dumps(res,indent=2))
如何使用此API包装器
api_client.endpoints.ENDPOINT_OF_YOUR_CHOICE.CALL_OF_YOUR_CHOICE()
[示例]检索用户
的所有货币帐户
importjsonfromapiwrapper.clients.api_client_persistingimportApiClientPersistinguser_id=1234api=ApiClientPersisting()res=api.endpoints.monetary_account.get_all_accounts_for_user(user_id)print(json.dumps(res,indent=2))
贡献
推荐PyPI第三方库