Skip to main content

A client library for jsonstore

Project description

json-store-client

A Python client for jsonstore.io

Installation

pip install json-store-client

Usage

Demo of storing a Python object with json-store-client in async on repl.it.

import json_store_client

jsonStoreToken = '...' # Insert your token here.
client = json_store_client.AsyncClient(jsonStoreToken)
async def demo_function():
 # Save data to the 'foo' key.
 await client.store('foo', {'alfa': 'bravo', 'charlie': 'delta'})

 # Save data with dict mapping
 await client.save_multiple({'foo':{'alfa': 'bravo', 'charlie': 'delta'}})

 # Get the data from the 'foo' key.
 data = await client.retrieve('foo')

 print(data['alfa']) # => 'bravo'

 # Deletes the data after printing parts of it.
 await client.delete('foo')

json-store-client API

json_store_client.Client(token)

json_store_client.AsyncClient(token)

Returns the client to use for data operations.

token (str): The API token from jsonstore.io

client.store(key, data[, timeout])

await client.store(key, data[, timeout])

Storing data in jsonstore with a key

key (str): The key to be stored on jsonstore
data (any): The data to be stored under the key. It can be any Python objects. Will be processed with jsonpickle
timeout (int): The timeout for the http request. Default 5 seconds

client.store_multiple(data[, timeout])

await client.store_multiple(data[, timeout])

Storing data in jsonstore with a dict mapping

data (dict): A dict of {key(s):value(s)} to be updated. Value(s) can be any python object, will be dumped with jsonpickle
timeout (int): The timeout for the http request. Default 5 seconds

client.retrieve(key[, timeout])

await clent.retrieve(key[, timeout])

Retrieve data in jsonstore with a key

If nothing is saved under the key, it will return None.
key (str): The key to get on jsonstore
timeout (int): The timeout for the http request. Default 5 seconds

client.delete(key[, timeout])

await client.delete(key[, timeout])

Delete data in jsonstore with a key

key (str): The key to get on jsonstore
timeout (int): The timeout for the http request. Default 5 seconds

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

json-store-client-1.0.2.tar.gz (3.6 kB view details)

Uploaded Source

File details

Details for the file json-store-client-1.0.2.tar.gz.

File metadata

  • Download URL: json-store-client-1.0.2.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.1

File hashes

Hashes for json-store-client-1.0.2.tar.gz
Algorithm Hash digest
SHA256 17bf9a26782b5eb97bb3fadcea245c153189b010858bbc672c5ae6729c9cdfe7
MD5 ff899a3e9a235ecd0f41940236168137
BLAKE2b-256 c0c18ddf357ec894fe9e6e762d46f6a2528433551e81c2cccc228445374c3d85

See more details on using hashes here.

Supported by

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