Skip to main content

A simple wrapper for CouchDB

Project description

Cushion: a simple CouchDB Document API wrapper

This is a Python wrapper for the CouchDB Document API (http://wiki.apache.org/couchdb/HTTP_Document_API).
It was created primarily as an exercise to learn CouchDB's document API.
The library attempts to expose a very simple interface that closely resembles REST.

For example,

from cushion import api

c = api.Cushion("http://localhost:5984/albums",
username='abc',
password='xyz'
)
c.get(id='1b0c7bb19b1bbacf7f567bf379000d9c')

returns the following JSON object:

{
'Band': 'The Postal Service',
'_rev':'1-f319aeef4dbb8c232f0257cf2a9ae64b',
'_id': '1b0c7bb19b1bbacf7f567bf379000d9c',
'Name': 'Give Up'
}

alternatively, the database can be specified at runtime,

c = api.Cushion("http://localhost:5984",
username='abc',
password='xyz',
timeout=5
)
c.get.albums(id='1b0c7bb19b1bbacf7f567bf379000d9c')

which also returns:

{
'Band': 'The Postal Service',
'_rev':'1-f319aeef4dbb8c232f0257cf2a9ae64b',
'_id': '1b0c7bb19b1bbacf7f567bf379000d9c',
'Name': 'Give Up'
}

to create a document with a document id:

c.put.albums(id='c3ea09f0-9758-480c-aa25-0f71a9caa446', Name='Transatlanticism', Band='Death Cab For Cutie')

alternatively, to create a document without supplying the document id:

c.post.albums(Name='In Ghost Colors', Band='Cut Copy')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

cushion-0.2-py2.6.egg (6.5 kB view details)

Uploaded Egg

File details

Details for the file cushion-0.2-py2.6.egg.

File metadata

  • Download URL: cushion-0.2-py2.6.egg
  • Upload date:
  • Size: 6.5 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cushion-0.2-py2.6.egg
Algorithm Hash digest
SHA256 9d86f90dd1cebc0143595387dbae042ab6e09b4f63de118adfaf241a3f4ace0d
MD5 553b99e209b63f9b83ecd5be4b67f08b
BLAKE2b-256 0f0aa7a9fa4d1194a14da156a7e78b25089c900de01c2f8cbe88e3960e1bc186

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page