用烧瓶药水编写的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 log4j找不到log4jtest。房产?   我在java线程“awteventque1”中获得异常。lang.NullPointerException   java为什么在使用完整路径从文件系统读取文件时出错?   java如何迭代所有注册表项?   java中的安卓 Opencv SVM未正确训练   多线程Java ThreadPoolExecutor关闭特定线程?   如何使用Java NIO CreateDirectory方法设置目录所有者组?   java NatTable混合了固定宽度的列和可调整大小的填充剩余空间   java如何删除特定网络,即使该网络是由安卓上的其他设备创建的?   java Guava toJavaUtil()不存在   java对许多常量使用枚举是有效的memorywise?   java是否可以使用坐标定位JButton?   从WSDL生成java代码导致异常   java如何在安卓中导出javadoc   爬行JAX中的java NoClassDefFoundError错误   java为片段中的文本视图设置区域设置   发送最后一条消息后发生Java RMI RemoteException