restfull 1.0.9

Creator: railscoder56

Last updated:

Add to Cart

Description:

restfull 1.0.9

restfull 1.0.9
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

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.