Class Server
object --+
|
Server
Representation of a CouchDB server.
>>> server = Server('http://localhost:5984/')
This class behaves like a dictionary of databases. For example, to get a
list of database names on the server, you can simply iterate over the
server object.
New databases can be created using the create method:
>>> db = server.create('python-tests')
>>> db
<Database 'python-tests'>
You can access existing databases using item access, specifying the database
name as the key:
>>> db = server['python-tests']
>>> db.name
'python-tests'
Databases can be deleted using a del statement:
>>> del server['python-tests']
|
__init__(self,
uri)
Initialize the server object. |
|
|
|
__contains__(self,
name)
Return whether the server contains a database with the specified
name. |
|
|
|
__iter__(self)
Iterate over the names of all databases. |
|
|
|
__len__(self)
Return the number of databases. |
|
|
|
|
|
__delitem__(self,
name)
Remove the database with the specified name. |
|
|
Database
|
__getitem__(self,
name)
Return a Database object representing the database with the
specified name. |
|
|
Database
|
create(self,
name)
Create a new database with the given name. |
|
|
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__ ,
__str__
|
unicode
|
version
The version number tuple for the CouchDB server.
|
Inherited from object :
__class__
|
__init__(self,
uri)
(Constructor)
|
|
Initialize the server object.
- Parameters:
uri - the URI of the server (for example
http://localhost:5984/)
- Overrides:
object.__init__
|
__contains__(self,
name)
(In operator)
|
|
Return whether the server contains a database with the specified
name.
- Parameters:
- Returns:
True if a database with the name exists, False otherwise
|
__repr__(self)
(Representation operator)
|
|
repr(x)
- Overrides:
object.__repr__
- (inherited documentation)
|
__delitem__(self,
name)
(Index deletion operator)
|
|
Remove the database with the specified name.
- Parameters:
name - the name of the database
- Raises:
|
__getitem__(self,
name)
(Indexing operator)
|
|
Return a Database object representing the database with the
specified name.
- Parameters:
name - the name of the database
- Returns: Database
- a Database object representing the database
- Raises:
|
Create a new database with the given name.
- Parameters:
name - the name of the database
- Returns: Database
- a Database object representing the created database
- Raises:
|
version
The version number tuple for the CouchDB server.
Note that this results in a request being made, and can also be used
to check for the availability of the server.
- Get Method:
- _get_version(self)
- Type:
unicode
|