Python interface to Aerospike REST Client
Project description
Python interface to the Aerospike REST Client.
Provides a simple convenience wrapper around requests for using the Aerospike REST Client in Python.
- Enable/disable compression
- Enable/disable authentication (via Authorization header)
- Override default user-agent header
- Override default connect and read timeouts
- Make use of keep-alive (for lifetime of object)
- Raise exceptions with Aerospike error codes
Simple Example
from aerospike_rest.api import AerospikeRestApi
api = AerospikeRestApi('http://localhost:8080/v1')
bins = {'mybin': "Hello World!"}
api.post('/kvs/mynamespace/myset/mykey', bins)
Advanced Example
from aerospike_rest.api import AerospikeRestApi
from aerospike_rest.exceptions import AerospikeRestApiError
api = AerospikeRestApi('http://localhost:8080/v1')
api.http_compression = False
api.client_compression = True
api.authorization = 'Authorization: Basic YWRtaW46YWRtaW4='
bins = {'mybin': "Hello World!"}
params = {
'recordExistsAction': "CREATE_ONLY"
}
headers = {
'X-Custom-Header': 'hello'
}
try:
api.post('/kvs/mynamespace/myset/mykey', bins, params, headers, timeout=10)
except AerospikeRestApiError as err:
if err.code == KEY_EXISTS_ERROR:
pass
else:
raise err
Test
Run unit tests from the root directory:
python -m unittest -v -b
View test coverage from root directory:
coverage run --source=aerospike_rest/ -m unittest -v -b && coverage report
Release
- Create version branch:
git checkout -b version/v1.0.0
) - Bump version in
aerospike_rest/__init__.py
and commit the change - Tag the commit:
git tag -a v1.0.0 -m 'Release v1.0.0
- Submit PR
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file aerospike_rest-0.2.0b20210902102909-py3-none-any.whl
.
File metadata
- Download URL: aerospike_rest-0.2.0b20210902102909-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c47ab7eafda034fb5f2175f30504fd79d5ff1af7d573967f657f7b23f97034b7 |
|
MD5 | 77ecab3f72aea883f6d57a5625354b5c |
|
BLAKE2b-256 | 735ab8ca6b1daf50e47294c9151f4f762a7a821a000adf498e0bb5207bffa061 |