ds_stoa.order._order

This module is designed to facilitate sending order requests to the Stoa API, allowing for the automated ordering of data or services provided by the Stoa platform.

It utilizes the order function to communicate with the Stoa API, sending order requests based on specified parameters and an authentication token. The function is designed to work in different environments (development and production) by selecting the appropriate API endpoint.

The order function returns the response from the Stoa API as a JSON object, which typically includes details about the order that was placed.

Dependencies: - requests: For making HTTP requests to the Stoa API. - os: For reading environment variables to determine the running environment. - utils.exceptions: For enriching HTTP exceptions with more context. - utils.logger: For logging information about the order request and its outcome.

Example Usage:

from ds_stoa.order import order

# Authentication token and parameters for the order
token = "your_auth_token"
params = {
    "product_group_name": "your_product_group_name",
    "product_name": "your_product_name",
    "workspace": "your_workspace",
    "owner_id": "your_owner_id",
    "version": "1.0",
    "offset": "0",
    "limit": "20",
    "ascending": "False",
}

# Send an order request
order_ids = order(token=token, params=params)
print(order_ids)

Attributes

LOGGER

BUILDING_MODE

Functions

enrich_http_exception(→ None)

Enriches an HTTP exception with additional context without re-raising it.

order(→ List[str])

Send order request to Stoa API.

Module Contents

ds_stoa.order._order.enrich_http_exception(exc: requests.exceptions.HTTPError) None

Enriches an HTTP exception with additional context without re-raising it.

Parameters:

exc – Exception

Returns:

None

ds_stoa.order._order.LOGGER
ds_stoa.order._order.BUILDING_MODE
ds_stoa.order._order.order(token: str, params: Dict) List[str]

Send order request to Stoa API.

Parameters:
  • token – Authentication token required for the API request.

  • params – Parameters for the order request, such as product ID and quantity.

Returns:

A dictionary containing the response from the Stoa API.

Example:

>>> order(token=token, params=params)
["12345.snappy.parquet", "67890.snappy.parquet"]