Skip to main content

S1 API Library for Python

Project description

S1 Python

A barebones key-value store that requires no setup besides a token. This is the Python Library for S1. Find more information here

Getting A Token

Head over to s1.kognise.dev/token to get a token. Don't share this with anyone as it's your key to accessing all your data on your S1 DB. You can store this as an environment variable.

Installation

First, install S1 with pip:

$ pip install s1db

Then you can import it like so:

from s1db import S1

# Replace "your-token-here" with the token you got from the URL above.
api = S1("your-token-here")

Usage

Setting Objects as Values:

To set a Python object as a value use the S1.set() method.

api.set('keyname', 123)
api.set('keyname0', [23])
api.set('keyname1', {'foo': 'bar'})

The set method will automatically serialize your data for you into valid JSON to be stored on the S1 DB.

Getting An Object:

To get an object from your S1 DB use the S1.get() method.

api.get('keyname') # Returns: 123 based on the set example from above.
api.get('keyname0') # Returns: [23] as a list based on the set example from above.
api.get('keyname1') # Returns: {'foo': 'bar'} as a Python dict based on the set example from above.

Setting Raw Values:

To set a raw string as a value use the S1.set_raw() method.

api.set_raw('keyname-raw', '12')
api.set_raw('keyname-raw0, '{"foo": "bar"}')

The set_raw method does not do any JSON serialization and raw items cannot be returned with the get() method.

Getting Raw Values:

To get a raw value from a key use the S1.get_raw() method.

api.get_raw('keyname-raw') # Returns: 12 with no serialization
api.get_raw('ketname-raw0') # Returns: '{"foo": "bar"}' as string

Deleting Keys:

To delete data use the S1.delete() method.

api.delete('keyname')

Getting All Keys:

To get all your keys use the S1.get_keys() method.

api.get_keys() # Returns: List of key names as Python object.

Download files

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

Source Distribution

s1db-1.0.1.tar.gz (2.4 kB view details)

Uploaded Source

Built Distributions

s1db-1.0.1-py3.7.egg (4.5 kB view details)

Uploaded Source

s1db-1.0.1-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file s1db-1.0.1.tar.gz.

File metadata

  • Download URL: s1db-1.0.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.6.0 requests-toolbelt/0.8.0 tqdm/4.33.0 CPython/3.7.3

File hashes

Hashes for s1db-1.0.1.tar.gz
Algorithm Hash digest
SHA256 75b768060c1a7597537fd6da6ffa7df2cd71c62896afd15ac809b5c40c92d93e
MD5 71ea834bad31158e344a628b479ea4d1
BLAKE2b-256 c1183078c6fae1d5f996f224655bd6de395dd394f077edb6a27e70eb5e32e259

See more details on using hashes here.

File details

Details for the file s1db-1.0.1-py3.7.egg.

File metadata

  • Download URL: s1db-1.0.1-py3.7.egg
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.6.0 requests-toolbelt/0.8.0 tqdm/4.33.0 CPython/3.7.3

File hashes

Hashes for s1db-1.0.1-py3.7.egg
Algorithm Hash digest
SHA256 dbad66de5b49c4fc5ef76b1626814541adff9470ec466ec857af8e768b37c01f
MD5 65b37ef180caaba72833f8f4272ca995
BLAKE2b-256 b77a7bc3fc326b9a1779b7483b9feda3aa3fc365a2929656e526dc394fbfee6e

See more details on using hashes here.

File details

Details for the file s1db-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: s1db-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.6.0 requests-toolbelt/0.8.0 tqdm/4.33.0 CPython/3.7.3

File hashes

Hashes for s1db-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9b96038a818d1a050881bdb0ed9a0bcd15c7ba0b6c595a854668c878dff8dfeb
MD5 0f13852da8a1b2161395d6ebfa50b9c7
BLAKE2b-256 5c55dc58488a7450a576e1254349045b48b6f8d98fc61fa4f831f933e230e59f

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