Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

A client for APIs written in Flask-Potion

Project Description

Description

This is a Python client for APIs written in Flask-Potion (a powerful Flask extension for self-documenting JSON APIs).

The package uses Requests to provide a super-simple interface to Potion APIs that works with all common authentication methods. It generates classes for each of the resources in the API and automatically handles pagination and resolving and serializing references. It also has some basic IPython Notebook support.

Example

from potion_client import Client
from potion_client.auth import HTTPBearerAuth
from potion_client.exceptions import ItemNotFound

client = Client('http://localhost/api', auth=HTTPBearerAuth('79054025255fb1a26e4bc422aef54eb4'))

u123 = client.User(123)

chomp = client.Animal()
chomp.owner = u123
chomp.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))

for pet in pets:
    if pet is not chomp:
        pet.add_friend(chomp)
        print("{} is now friends with Chomp".format(pet.name)))

try:
    foo = client.User.first(where={"username": "foo"})
except ItemNotFound:
    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.")

Installation

To install potion-client, run:

pip install potion-client

Authors

Potion-client was written by João Cardoso and Lars Schöning.

Release History

Release History

This version
History Node

2.5.1

History Node

2.5.0

History Node

2.4.2

History Node

2.4.1

History Node

2.4.0

History Node

2.1.3

History Node

2.1.2

History Node

2.1.1

History Node

2.1.0

History Node

2.0.1

History Node

2.0.0

History Node

0.1.1

History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
Potion-client-2.5.1.tar.gz (11.0 kB) Copy SHA256 Checksum SHA256 Source Apr 12, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting