Amber documentation

Amber is a python library that provides object orientated interface to REST APIs like Tastypie.

Installation

$ pip install -e hg+https://bitbucket.org/ad3w/amber#egg=amber

Examples

First create the your amber api instance:

api = amber.Api('http://localhost:8000/api/v1/', ('username', 'password'))

GET:

api.get('entry') # get all entries
api.get('entry', 1) # get entry with id == 1

POST:

api.post('entry', {'title': 'Hello', 'content': 'Hello, world!'}) # create a new entry

PUT:

data = {
   'title': 'New title',
   'content': 'New content',
}
api.put('entry', 1, data) # update entry with id == 1

PATCH:

api.patch('entry', 1, {'title': New title'}) # partially update entry with id == 1

DELETE:

api.delete('entry') # delete all entries
api.delete('entry', 1) # delete entry with id == 1

Fetch URI:

api.uri('entry', 1) # fetch URI of this object