Python utilities for interacting with ShorthandAI data
Project description
shorthandai
This package provides a Python SDK for working with the ShorthandAI platform.
Installation
$ pip install shorthandai
Usage
from shorthandai import ShorthandAI
# Token can be passed by setting the environment variable `SHORTHANDAI_TOKEN`.
# token can be generated at https://apiv1.shorthand.ai/console/tokens
SH = ShorthandAI()
# Alternately, pass in the token explicitly
token = 'sh-...'
SH = ShorthandAI(token)
# Get values
print(SH.get("dev123"))
# Set values
print(SH.set("dev123", 4000))
import datetime
# Get historical
print(SH.geth("dev123", datetime.datetime(2022, 12, 31)))
For example, new users can try out the following:
from shorthandai import ShorthandAI
SH = ShorthandAI('demo')
print(SH.info())
print(SH.GET('dev123', '1659994710026'))
print(SH.GET('dev123', 'notexists'))
print(SH.GET('dev123'))
print(SH.GET('dev444'))
print("\nTesting GET-historical\n")
import datetime
print(SH.GETH('dev123', datetime.datetime(2022, 12, 31)))
print(SH.GETH('dev123', datetime.datetime(2022, 11, 1)))
print(SH.GETH('dev123', datetime.datetime(2023, 2, 24)))
print("\nTesting SET\n")
print(SH.SET('dev555-scalar', 1000))
print(SH.GET('dev555-scalar'))
new_df = pd.DataFrame({
'Name': ['Tom', 'nick', 'krish', 'jack'],
'Age': [20, 21, 19, 18]
})
print(new_df)
print(SH.SET('dev777-pd', new_df))
print(SH.GET('dev777-pd'))
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 Distribution
shorthandai-0.0.4.tar.gz
(3.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shorthandai-0.0.4.tar.gz.
File metadata
- Download URL: shorthandai-0.0.4.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2459edde9e089fdc111590ec111fda3dcb1cfecada595cc88ed85bb7f9de1083
|
|
| MD5 |
ca337fb1b655934ca7de2972e60d36ac
|
|
| BLAKE2b-256 |
8da0e3f18ff8299cce0a358dcf5c1707b644f27b694006a4e8b5d458581e5bbd
|
File details
Details for the file shorthandai-0.0.4-py3-none-any.whl.
File metadata
- Download URL: shorthandai-0.0.4-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2ca1be76afde0cf30be69962bf54a1b108abe2494cfe220a078d3860015a889
|
|
| MD5 |
3b5b472e581a051bd34f434771dde0a9
|
|
| BLAKE2b-256 |
681461fabbe1b89a2b01d2c1ce38bf4c62d78cfd2d6669c9460e5a30092a2f78
|