Python REST API Frontend
Project description
restfull 1.0.10
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.10.tar.gz
(6.5 kB
view hashes)
Built Distribution
Close
Hashes for restfull-1.0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abfba9510724dbaab873d79c2a2a492c0910d7f7e22d32a4d603f81af89b6545 |
|
MD5 | 24d972d70c478321613b427c09c2a84d |
|
BLAKE2b-256 | a582479c56dd9b31c3e9fd9502e192e3f3f2bd35456198e2a6a312ab57034dd0 |