Package grassyknoll :: Package client :: Module RestClient :: Class RestClient
[hide private]

Class RestClient

source code


A low-level client for a RestCollection

Instance Methods [hide private]
 
__init__(self, base_uri=None, mimetype=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
tuple of httplib2.Response, string
list(self)
list documents
source code
tuple of httplib2.Response, string
retrieve(self, id, fields=None)
retrieve a single result
source code
tuple of httplib2.Response, string
retrieveMany(self, ids, fields=None)
retrieve several results
source code
tuple of httplib2.Response, string
create(self, doc, id=None)
create a single document
source code
tuple of httplib2.Response, string
createMany(self, docs)
create several documents
source code
tuple of httplib2.Response, string
delete(self, id)
delete a single document
source code
tuple of httplib2.Response, string
deleteMany(self, ids)
delete several documents
source code
 
query(self, name, **kwargs) source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Methods [hide private]

Inherited from lib.meta.FactoryMixin: factory

Static Methods [hide private]
 
query_string(**d)
return a query string fragment from kwargs.
source code
Instance Variables [hide private]
string mimetype = 'application/json'
mimetype to use for when communicating with server
string base_uri = "http://localhost:8080/"
url to the server.
dict headers
common request headers to send to server
httplib2.Http http
a connection for talking to the server
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, base_uri=None, mimetype=None)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

list(self)

source code 
list documents
Returns: tuple of httplib2.Response, string
response and body

retrieve(self, id, fields=None)

source code 
retrieve a single result
Parameters:
  • id (unicode) - the id of the result to retrieve
  • fields (list of string) - names of fields to retrieve. If None, retrieve all fields.
Returns: tuple of httplib2.Response, string
response and body

retrieveMany(self, ids, fields=None)

source code 
retrieve several results
Parameters:
  • ids (list of unicode) - the ids of the result to retrieve
  • fields (list of string) - names of fields to retrieve. If None, retrieve all fields.
Returns: tuple of httplib2.Response, string
response and body

create(self, doc, id=None)

source code 
create a single document
Parameters:
  • doc (dict of unicode => basic python types) - a document to create
  • id (unicode) - the id of the document to create. If None and no __id__ is present in doc, an id will be assigned by server.
Returns: tuple of httplib2.Response, string
response and body

createMany(self, docs)

source code 
create several documents
Parameters:
  • docs - documents to create. All docs must have an __id__
Returns: tuple of httplib2.Response, string
response and body

delete(self, id)

source code 
delete a single document
Parameters:
  • id (unicode) - id of the document to delete
Returns: tuple of httplib2.Response, string
response and body

deleteMany(self, ids)

source code 
delete several documents
Parameters:
  • ids - ids of the documents to delete
Returns: tuple of httplib2.Response, string
response and body

query_string(**d)
Static Method

source code 
return a query string fragment from kwargs. For internal use

Instance Variable Details [hide private]

base_uri

url to the server. Must end in /
Type:
string
Value:
"http://localhost:8080/"