Python REST API Frontend
Project description
restfull 1.0.11
Installing
$ pip install restfull
Usage Examples
Basic API GET:
auth = BasicAuth("username", "password")
rest = RestAPI(auth, "example.com")
endpoint = "/api/users/1"
data = rest.get(endpoint).validate().as_json().record()
assert data.get("data", {}).get("id") == 1
Get record with paged API (specifically getting page 2)
auth = BasicAuth("username", "password")
rest = RestAPI(auth, "example.com")
endpoint = "/api/users"
data = rest.get_by_page(endpoint, page=2).validate().as_json("data").list_item(2)
assert data.get("id") == 9
Get all records from paged API (assumes records are in an array assigned to the "data" key):
auth = BasicAuth("username", "password")
rest = RestAPI(auth, "example.com")
endpoint = "/api/users"
data = rest.get_paged(endpoint).validate().json_list()
assert data.size == 12
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
restfull-1.0.11.tar.gz
(7.2 kB
view hashes)
Built Distribution
Close
Hashes for restfull-1.0.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 928b73929b4fec7b9a59329d718ac682ed13c7e012fdf70fe59efbbf30edc963 |
|
MD5 | 91a2a34640bfb335d790d1d21f39afbe |
|
BLAKE2b-256 | 58e615612faefc3a37620b1c491fb0f9aba051c49a51e9fddfc50fdba889be07 |