用烧瓶药水编写的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 ActionListen没有在JMenu上启动   java如何在并发环境中获取DynamoDB中的下一个空闲项   java初始化抽象类的一般变量   javakerberos中的智能卡   如何在java中关闭客户端socket?   java向加载到内存中的文件追加字符的最快/最有效的方法是什么?   java正则表达式,用于过滤带有多个关键字的特定URL   java在带有分隔符的字符串中查找和删除子字符串(开始:55555,结束:\n)   java找不到gradle包装器   java如何为雪碧的特定部分着色   java当spring启动应用程序初始化时,如何获取@FeignClient bean   默认接口方法的java代码生成(IDEA)