Package couchdbkit :: Module resource :: Class CouchdbResource
[hide private]
[frames] | no frames]

Class CouchdbResource

source code

               object --+    
                        |    
restkit.resource.Resource --+
                            |
                           CouchdbResource

Nested Classes [hide private]

Inherited from restkit.resource.Resource: response_class

Instance Methods [hide private]
 
__init__(self, uri='http://127.0.0.1:5984', **client_opts)
Constructor for a `CouchdbResource` object.
source code
 
copy(self, path=None, headers=None, **params)
add copy to HTTP verbs
source code
 
request(self, method, path=None, payload=None, headers=None, **params)
Perform HTTP call to the couchdb server and manage JSON conversions, support GET, POST, PUT and DELETE.
source code

Inherited from restkit.resource.Resource: __call__, __repr__, clone, delete, get, head, make_headers, make_params, post, put, unauthorized, update_uri

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from restkit.resource.Resource: basic_auth_url, charset, encode_keys, safe

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, uri='http://127.0.0.1:5984', **client_opts)
(Constructor)

source code 

Constructor for a `CouchdbResource` object.

CouchdbResource represent an HTTP resource to CouchDB.

Parameters:
  • uri - str, full uri to the server.
Overrides: object.__init__

request(self, method, path=None, payload=None, headers=None, **params)

source code 
Perform HTTP call to the couchdb server and manage
JSON conversions, support GET, POST, PUT and DELETE.

Usage example, get infos of a couchdb server on
http://127.0.0.1:5984 :


    import couchdbkit.CouchdbResource
    resource = couchdbkit.CouchdbResource()
    infos = resource.request('GET')

@param method: str, the HTTP action to be performed:
    'GET', 'HEAD', 'POST', 'PUT', or 'DELETE'
@param path: str or list, path to add to the uri
@param data: str or string or any object that could be
    converted to JSON.
@param headers: dict, optional headers that will
    be added to HTTP request.
@param raw: boolean, response return a Response object
@param params: Optional parameterss added to the request.
    Parameterss are for example the parameters for a view. See
    `CouchDB View API reference
    <http://wiki.apache.org/couchdb/HTTP_view_API>`_ for example.

@return: tuple (data, resp), where resp is an `httplib2.Response`
    object and data a python object (often a dict).

Overrides: restkit.resource.Resource.request