Skip to main content

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


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.5.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shorthandai-0.0.5-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file shorthandai-0.0.5.tar.gz.

File metadata

  • Download URL: shorthandai-0.0.5.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for shorthandai-0.0.5.tar.gz
Algorithm Hash digest
SHA256 a44dfe39d0e88bc6693feac236da0f7a4fbb28f56e0e6a4edb344f78a416f0e1
MD5 c3dbc3bdebec687437a79d8e63d15c5f
BLAKE2b-256 bb33bd7c8dc037e57b002a9d73b604330c610ca757c511e3117e455288d7e268

See more details on using hashes here.

File details

Details for the file shorthandai-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: shorthandai-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for shorthandai-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ae2ccacee8e626f99afc3198b8734790b711e68df585076178e8b817dc1106ef
MD5 0d7f009e87b9fa93607c732bdaf8652f
BLAKE2b-256 a77842cb8d76b37337883a8dab2c3c82c78e05453969f1a8e77176670d716d17

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