Myst Python Library
This is the official Python client library for the Myst Platform.
Requirements
- Python 2.7+ or Python 3.4+
Installation
To install the package from PyPI:
$ pip install --upgrade myst
Authentication
The Myst API uses JSON Web Tokens (JWTs) to authenticate requests. The Myst Python library handles the sending of JWTs to the API automatically and currently supports two ways to authenticate to obtain a JWT: through your Google user account or a Myst service account.
Authenticating using your user account
If you don't yet have a Google account, you can create one on the Google Account Signup page.
Once you have access to a Google account, send an email to support@myst.ai with your email so we can authorize you to use the Myst Platform.
Use the following code snippet to authenticate using your user account:
import myst
myst.authenticate()
The first time you run this, you'll be presented with a web browser and asked to authorize the Myst Python library to make requests on behalf of your Google user account.
Authenticating using a service account
You can also authenticate using a Myst service account. To request a service account, email support@myst.ai.
To authenticate using a service account, set the MYST_APPLICATION_CREDENTIALS environment variable to the path to your service account
key file and specify use_service_account=True:
$ export MYST_APPLICATION_CREDENTIALS=</path/to/key/file.json>
import myst
myst.authenticate(use_service_account=True)
You can also explicitly pass the path to your service account key when authenticating:
import myst
myst.authenticate(
use_service_account=True,
service_account_key_file_path='/path/to/key/file.json',
)
Working with time series
The Myst python library currently supports listing, getting, and fetching data for time series.
Listing time series
import myst
myst.authenticate()
all_time_series = myst.TimeSeries.list()
Getting a time series
import myst
myst.authenticate()
time_series = myst.TimeSeries.get('fc84...')
Fetching data from a time series
You can either fetch data by specifying absolute start and end times, or offsets relative to the as_of_time. If no as_of_time is given,
it is assumed to mean "as of now":
import datetime
import pytz
import myst
myst.authenticate(...)
time_series = myst.TimeSeries.get('fc84...')
# Fetching data using absolute start and end times.
data_series = time_series.fetch_data_series(
start_time=datetime.datetime(2019, 1, 1),
end_time=datetime.datetime(2019, 1, 2),
)
# Fetching data specifying an as of time.
data_series = time_series.fetch_data_series(
start_time=datetime.datetime(2019, 1, 1),
end_time=datetime.datetime(2019, 1, 2),
as_of_time=datetime.datetime(2019, 1, 1, 12),
)
# Fetching data using offsets relative to now.
data_series = time_series.fetch_data_series(
start_offset=datetime.timedelta(hours=-12),
end_offset=datetime.timedelta(hours=12),
)
# Fetching data specifying a combination of relative offsets and absolute timestamps.
data_series = time_series.fetch_data_series(
start_offset=datetime.timedelta(hours=-12),
end_time=datetime.datetime(2019, 1, 2),
)
Support
For questions or just to say hi, reach out to support@myst.ai.
Metadata
Release files for myst 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| myst-1.0.4.tar.gz | 30.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| myst-1.0.4-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 70.4 kB
Release files / myst-1.0.4.tar.gz
| Download URL | myst-1.0.4.tar.gz |
|---|---|
| Size | 30.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7929dab96cb9493338838874a91321227c62864f13fb0c98cf13b88a4ae18065
|
|
BLAKE2b-256 checksum How to use checksums |
597e1fa7c1f07176bdf45271c7048c43604f1afc40ba018c27bdeb0849ea3cbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.3
|
Release files / myst-1.0.4-py2.py3-none-any.whl
| Download URL | myst-1.0.4-py2.py3-none-any.whl |
|---|---|
| Size | 39.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
c393762812055d968f1cf363011df2ece686ddf4e70e48b7be6aab025faa3825
|
|
BLAKE2b-256 checksum How to use checksums |
8dddd2173e29ea6d077c06df8ae58c068c277b02db281fc96518231640a3d6c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.3
|