用烧瓶药水编写的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检查服务器端广告查看(php)   Java将注释的使用限制在某些类型的方法上?   java使用gson重用顶级模型   当Java Spring作为Docker容器运行时,它不会与Concur对话   通过Java在不使用新URL()的情况下加载文件   Dicom4che调用的java结果不显示umlaut字符   java Updatea使用php/codeigniter使用ajax/javascript映射标记   Java8中的javaspringboot@ExceptionHandler未被访问   java如何读取长度未知的用户输入?   EclipseJava在MacBook和OSX上的性能非常差,而在Windows下在同一个单元上的性能就不那么差了,为什么?   java在Lucene查询语法中与+有什么区别   使用Spark和Cassandra Java驱动程序时检测到番石榴问题#1635   java工具栏标题未显示在选项卡式活动中