Skip to main content

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

  1. Create version branch: git checkout -b version/v1.0.0)
  2. Bump version in aerospike_rest/__init__.py and commit the change
  3. Tag the commit: git tag -a v1.0.0 -m 'Release v1.0.0
  4. Submit PR

Project details


Download files

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

Source Distribution

aerospike-rest-0.1.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

aerospike_rest-0.1.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file aerospike-rest-0.1.1.tar.gz.

File metadata

  • Download URL: aerospike-rest-0.1.1.tar.gz
  • Upload date:
  • Size: 6.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.2 CPython/3.6.13

File hashes

Hashes for aerospike-rest-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ff59922556f6f7418f23a4cde31350e92e9e3190cc5ea7f05d12dc01c1251774
MD5 fff651164ee706bb7f5aed25cade697d
BLAKE2b-256 a0f77555f44addb332b6dc87f7785cdfe6a565835fd61b6b8916d33a3b1c401f

See more details on using hashes here.

File details

Details for the file aerospike_rest-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: aerospike_rest-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.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.2 CPython/3.6.13

File hashes

Hashes for aerospike_rest-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 842cf1c0fc1c1e9f28050d036f729c15293c5ea8e5f8bb0e6669a8fbe0ab9fc6
MD5 a9f8a7008817a8778f8c0e397a740c17
BLAKE2b-256 b10e37f74faa4291ef57d12c7198faac62b7461249d455fb7e8a87edb44b7a95

See more details on using hashes here.

Supported by

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