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__.pyand commit the change - Tag the commit:
git tag -a v1.0.0 -m 'Release v1.0.0 - Submit PR
Metadata
Release files for aerospike-rest 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aerospike-rest-0.2.1.tar.gz | 7.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aerospike_rest-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.6 kB
Release files / aerospike-rest-0.2.1.tar.gz
| Download URL | aerospike-rest-0.2.1.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2823a391844b8c1f5aeff8523d7cc323b85800e10bc353a7e588d286f8d54424
|
|
BLAKE2b-256 checksum How to use checksums |
c454824a8a5c1d50457ade1fbab117256fee823320383fe969c9377c7f52dd87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.11.0 pkginfo/1.8.2 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10
|
Release files / aerospike_rest-0.2.1-py3-none-any.whl
| Download URL | aerospike_rest-0.2.1-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c786be090292704451ca807c45c27f1cdc1e655846e1244a1e7b187c7a7301e6
|
|
BLAKE2b-256 checksum How to use checksums |
db0316e4f928a1564d02b8526ff8070809132fb781a0931097c71b9b78870586
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.11.0 pkginfo/1.8.2 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10
|