用烧瓶药水编写的api客户端

Potion-client的Python项目详细描述


https://img.shields.io/travis/biosustain/potion-client/new-potion-client.svg?style=flat-squarehttps://img.shields.io/coveralls/biosustain/potion-client/new-potion-client.svg?style=flat-squarehttps://img.shields.io/pypi/v/Potion-Client.svg?style=flat-squarehttps://img.shields.io/pypi/l/Potion-Client.svg?style=flat-squareJoin the chat at https://gitter.im/biosustain/potion

说明

这是一个python客户端,用于用Flask-Potion(用于自文档json api的强大flask扩展)编写的api。

这个包使用Requests为药水api提供一个超级简单的接口 适用于所有常见的身份验证方法。它为api中的每个资源生成类,并自动处理分页。 以及解析和序列化引用。它还有一些基本的IPython Notebook支持。

示例

frompotion_clientimportClientfrompotion_client.authimportHTTPBearerAuthfrompotion_client.exceptionsimportItemNotFoundclient=Client('http://localhost/api',auth=HTTPBearerAuth('79054025255fb1a26e4bc422aef54eb4'))u123=client.User(123)chomp=client.Animal()chomp.owner=u123chomp.name="Chomp"chomp.species="hamster"chomp.save()pets=client.Animal.instances(where={"owner":u123},sort={"created_at":True})print("{} has {} pet(s)".format(u123.first_name,len(pets))forpetinpets:ifpetisnotchomp:pet.add_friend(chomp)print("{} is now friends with Chomp".format(pet.name)))try:foo=client.User.first(where={"username":"foo"})exceptItemNotFound:print("User 'foo' does not exist!")else:chomp.update(owner=foo)print("Chomp has been sold to {}".format(foo.name))chomp.destroy()print("RIP, Chomp. You lived a happy life.")

安装

要安装potion-client,请运行:

pip install potion-client

作者

药剂客户端由João CardosoLars Schöning编写。

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

推荐PyPI第三方库


热门话题
java Android操作共享首选项更新值   java是否可以在单个参数化测试之前执行一次方法?   Java创建临时文件   java字符串已定义但未解析?   java JOptionPane。showConfirmDialog返回int 01而不是字符串YN   java Unitronics OPC Server>JIException访问被拒绝   gzip使用Java组合压缩的gzip文本文件   java在灵活的环境中部署bigtable helloworld不起作用   aspectJ中的java字段读字段写访问   java Hibernate让它映射   找不到媒体类型为application/json、类型为class java的MessageBodyWriter。util。ArrayList   java在SpringMVC中将图像上传到服务器并在mysql数据库中存储引用   如何用Java制作自己的解释器?   java在移动应用程序上使用appium滚动并查找页面中的元素   java无法在重新启动springjdbc、CommonDBCP、tomcat时连接到数据库   java捕获非法argumentException的最佳方法是什么   设计模式避免Java代码重复的良好实践   Java ResourceBundle是如何实现的。getBundle加载属性文件?   java远程访问OpenMQ