Skip to main content

A lite client for restful APIs.

Project description

restful-client-lite

A lite client for RESTFul APIs.

WIP.

Installation

pipenv:

pipenv install -e git+https://github.com/huandzh/restful-client-lite#egg=restful-client-lite

pip:

pip install -e git+https://github.com/huandzh/restful-client-lite#egg=restful-client-lite

Usage

Assume that we have a restful api requiring Authorization:<token> in the header and using etag to control writes.

Create an API client:

from restful_client_lite import APIClient
api = APIClient("<api_root>", {"token": "<token>"})

Get from url:

res_get = api.get("<url>")

Post to url:

res_post = api.post("<url>", data={"<key>": "<value>"})

Patch url:

res_patch = api.patch("<url>", "<etag>", data={"<key>": "<value>"})

Patch url (fetch etag automatically in advance):

res_patch = api.patch_auto_etag("<url>", data={"<key>": "<value>"})

Delete url:

res_delete = api.delete("<url>", "<etag>")

Delete url (fetch etag automatically in advance):

res_delete = api.delete_auto_etag("<url>")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

restful-client-lite-0.0.1.tar.gz (3.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page