🛋 An asynchronous client library for CouchDB 2.x and 3.x
Project description
aiocouch
An asynchronous client library for CouchDB 2.0 based on asyncio using aiohttp
Key features
- All requests are asynchronus using aiohttp
- Supports CouchDB 2.x and 3.x
- Support for modern Python ≥ 3.6
Library installation
pip install aiocouch
Getting started
The following code retrieves and prints the list of incredients
of the apple_pie recipe
.
The incredients
are stored as a list in the apple_pie aiocouch.document.Document
,
which is part of the recipe
aiocouch.database.Database
. We use the context manager
aiocouch.CouchDB
to create a new session.
from aiocouch import CouchDB
async with CouchDB(
"http://localhost:5984", user="admin", password="admin"
) as couchdb:
db = await couchdb["recipes"]
doc = await db["apple_pie"]
print(doc["incredients"])
We can also create new recipes, for instance for some delicious cookies.
new_doc = await db.create(
"cookies", data={"title": "Granny's cookies", "rating": "★★★★★"}
)
await new_doc.save()
For further details please refer to the documentation, which is available here on readthedocs.org.
Run examples
- Setup the CouchDB URL and credentials using the environment variables
- Install dependencies using
pip install --editable '.[examples]'
- run for instance
python examples/getting_started.py
Run tests
- Install dependencies using
pip install --editable '.[tests]'
- Setup the CouchDB URL and credentials using the environment variables (
COUCHDB_HOST
,COUCHDB_USER
,COUCHDB_PASS
) - run
pytest --cov=aiocouch
Generate documentation
- Install dependencies using
pip install '.[docs]'
- switch to the
docs
directory:cd docs
- run
make html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file aiocouch-2.1.0.tar.gz
.
File metadata
- Download URL: aiocouch-2.1.0.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23b532d71ce3edb56c002d2aaa4de3bd2e2e6529e17397e557e8f83a4a4bfe9e |
|
MD5 | bfd99ed9a7c552815333f7e2314c49ae |
|
BLAKE2b-256 | ac59438aa99036a170ef7a38db8a260b1bf341e9724de2c5d7663eb20cc2461f |
File details
Details for the file aiocouch-2.1.0-py3-none-any.whl
.
File metadata
- Download URL: aiocouch-2.1.0-py3-none-any.whl
- Upload date:
- Size: 29.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cb5248e0b341b8fdf3fe704d728e167d352d9167276d5169ef25ae486bbece0 |
|
MD5 | 14a3874c316038ac88330659cfdbcf1b |
|
BLAKE2b-256 | 14e4fced0d22a40aaf7af2b939504fe7524df5c3ce863abb060d1d25bafd2f40 |