Resource
A Client which returns json content and has syntactic support for requests.
Usage
Resource()Methods
| Name | Description |
|---|---|
| __call__() | GET request with params. |
| __contains__() | Return whether endpoint exists according to HEAD request. |
| authorize() |
Acquire oauth access token and set Authorization header.
|
| create() | POST request and return location. |
| download() | Output streamed GET request to file. |
| request() | Send request with path and return processed content. |
| stream() | Iterate lines or chunks from streamed request. |
| update() | PATCH request with json params. |
| updating() | Context manager to GET and conditionally PUT json data. |
__call__()
GET request with params.
Usage
__call__(path="", **params)__contains__()
Return whether endpoint exists according to HEAD request.
Usage
__contains__(path)create()
POST request and return location.
Usage
create(path="", json=None, **kwargs)download()
Output streamed GET request to file.
Usage
download(file, path="", **kwargs)request()
Send request with path and return processed content.
Usage
request(method, path, **kwargs)stream()
Iterate lines or chunks from streamed request.
Usage
stream(method="GET", path="", **kwargs)update()
PATCH request with json params.
Usage
update(path="", callback=None, **json)Parameters
callback: Callable | None = None-
optionally update with GET and validated PUT.
callbackis called on the json result with keyword params, i.e.,dictcorrectly implements the simple update case.
updating()
Context manager to GET and conditionally PUT json data.
Usage
updating(path="", **kwargs)