Package couchdbkit :: Module client :: Class Server
[hide private]
[frames] | no frames]

Class Server

source code

object --+
         |
        Server

Server object that allows you to access and manage a couchdb node. A Server object can be used like any `dict` object.

Instance Methods [hide private]
 
__init__(self, uri='http://127.0.0.1:5984', uuid_batch_count=DEFAULT_UUID_BATCH_COUNT, resource_instance=None)
constructor for Server object
source code
 
info(self, _raw_json=False)
info of server
source code
 
all_dbs(self, _raw_json=False)
get list of databases in CouchDb host
source code
 
create_db(self, dbname)
Create a database on CouchDb host
source code
 
get_or_create_db(self, dbname)
Try to return a Database object for dbname.
source code
 
delete_db(self, dbname)
Delete database
source code
 
replicate(self, source, target, continuous=False)
simple handler for replication
source code
 
uuids(self, count=1, raw=False) source code
 
next_uuid(self, count=None)
return an available uuid from couchdbkit
source code
 
add_authorization(self, obj_auth)
Allow you to add basic authentication or any authentication object inherited from `restkit`.
source code
 
__getitem__(self, dbname) source code
 
__delitem__(self, dbname) source code
 
__contains__(self, dbname) source code
 
__iter__(self) source code
 
__len__(self) source code
 
__nonzero__(self) source code
 
_db_uri(self, dbname) source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, uri='http://127.0.0.1:5984', uuid_batch_count=DEFAULT_UUID_BATCH_COUNT, resource_instance=None)
(Constructor)

source code 

constructor for Server object

Parameters:
  • uri - uri of CouchDb host
  • uuid_batch_count - max of uuids to get in one time
  • resource_instance - `restkit.resource.CouchdbDBResource` instance. It alows you to set a resource class with custom parameters.
Overrides: object.__init__

info(self, _raw_json=False)

source code 

info of server

Parameters:
  • _raw_json - return raw json instead deserializing it
Returns:
dict

all_dbs(self, _raw_json=False)

source code 

get list of databases in CouchDb host

Parameters:
  • _raw_json - return raw json instead deserializing it

create_db(self, dbname)

source code 

Create a database on CouchDb host

Parameters:
  • dname - str, name of db
Returns:
Database instance if it's ok or dict message

get_or_create_db(self, dbname)

source code 

Try to return a Database object for dbname. If database doest't exist, it will be created.

replicate(self, source, target, continuous=False)

source code 

simple handler for replication

Parameters:
  • source - str, URI or dbname of the source
  • target - str, URI or dbname of the target
  • continuous - boolean, default is False, set the type of replication

    More info about replication here : http://wiki.apache.org/couchdb/Replication

add_authorization(self, obj_auth)

source code 

Allow you to add basic authentication or any authentication object inherited from `restkit`.

ex:

>>> from couchdbkit import Server
>>> from restkit import BasicAuth
>>> server = Server()
>>> server.add_authorization(BasicAuth(username, password))