Skip to main content

A client for APIs written in Flask-Potion

Project description Join the chat at


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.


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"
chomp.species = "hamster"

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:
        print("{} is now friends with Chomp".format(

    foo = client.User.first(where={"username": "foo"})
except ItemNotFound:
    print("User 'foo' does not exist!")
    print("Chomp has been sold to {}".format(

print("RIP, Chomp. You lived a happy life.")


To install potion-client, run:

pip install potion-client


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

Project details

Download files

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

Files for Potion-client, version 2.5.1
Filename, size File type Python version Upload date Hashes
Filename, size Potion-client-2.5.1.tar.gz (11.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page