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
Metadata
Release files for Potion-client 2.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| Potion-client-2.5.1.tar.gz | 11.0 kB | Without provenance | Details for Potion-client-2.5.1.tar.gz |
Release files / Potion-client-2.5.1.tar.gz
| Download URL | Potion-client-2.5.1.tar.gz |
|---|---|
| Size | 11.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bfc1ca6c0feac683ff20f41bb13769754b9badde4d9ed7c0759799ae07398b5d
|
|
BLAKE2b-256 checksum How to use checksums |
101604e56c52d5a9090f655f573fa2caf03b845ffee78bfc8d08ce99064a00aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for Potion-client 2.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.