Skip to main content

Overview

clope is a Python package for interacting with the Cantaloupe/Seed Pro system. clope touches a couple different APIs/interfaces: the Spotlight reporting API, the Snowflake data warehouse, and the Prepick SOAP interface. All relate to Cantaloupe but have different credentials and are separate add-ons.

Installation

Each of the three modules is separated into optional dependency groups so that you only pull in the dependencies you need. A base install will not include any dependencies (Note: this differs from previous releases where spotlight module was treated as the default).

# All modules/dependencies
pip install "clope[all]"

# Spotlight only
pip install "clope[spotlight]"

# Prepick and Snowflake
pip install "clope[prepick,snow]"

# etc., whatever combos

Usage

Several environment variables are required for clope to function. Functionality is divided into three modules, so vars are only required if you are using functions from that particular module.

Module Required? Env Variable Description
Spotlight Yes CLO_USERNAME Username of the Spotlight API user. Should be provided by Cantaloupe.
Spotlight Yes CLO_PASSWORD Password of the Spotlight API user. Should be provided by Cantaloupe.
Spotlight No CLO_BASE_URL Not actually sure if this varies between clients. I have this as an optional variable in case it does. Default value if no env variable is https://api.mycantaloupe.com, otherwise can be overridden.
Snowflake Yes SNOWFLAKE_USER Username of the Snowflake user
Snowflake Yes SNOWFLAKE_PRIVATE_KEY_FILE Path pointing to the private key file for the Snowflake user.
Snowflake Yes SNOWFLAKE_PRIVATE_KEY_FILE_PWD Password for the private key file
Snowflake Yes SNOWFLAKE_ACCOUNT Snowflake account you're connecting to. Should be something along the lines of "{Cantaloupe account}-{Your Company Name}"
Snowflake Yes SNOWFLAKE_DATABASE Snowflake database to connect to. Likely begins with "PRD_SEED...".
Snowflake Yes SNOWFLAKE_WAREHOUSE Snowflake warehouse to connect to.
Prepick Yes PREPICK_USERNAME Username for the Prepick SOAP interface.
Prepick Yes PREPICK_PASSWORD Password for the Prepick SOAP interface.

Quick start:

from clope.spotlight import run_report
df_report = run_report(
 "123",
 [("filter0", "2024-01-01"), ("filter1", "2024-01-31")],
)

from clope.snow import facts
df_sales = facts.get_sales_revenue_by_day_fact(branch=1, location=2)

import asyncio
from clope.prepick import PrepickClient
cli = PrepickClient()
items = asyncio.run(cli.load_items())

Spotlight

The spotlight module involves interaction with the Cantaloupe Spotlight API. The API allows you to run a Spotlight report remotely and retrieve the raw Excel data via HTTP requests. Reports must be set up in Seed Office prior to using the API. This is quick and suited for getting data that needs to be up-to-date at that moment.

Run Spotlight Report (run_report())

The primary function. Used to run a spotlight report, retrieve the excel results, and transform the excel file into a workable pandas dataframe. Cantaloupe's spotlight reports return an excel file with two tabs: Report and Stats. This pulls the info from the Report tab, Stats is ignored.

Note: Make sure your spotlight report has been shared with the "Seed Spotlight API Users" security group in Seed Office. Won't be accessible otherwise.

Takes in two parameters:

report_id

A string ID for the report in Cantaloupe. When logged into Seed Office, the report ID can be found in the URL. E.G. https://mycantaloupe.com/cs3/ReportsEdit/Run?ReportId=XXXXX, XXXXX being the report ID needed.

params

Optional parameter, list of tuples of strings. Some Spotlight reports have required filters which must be supplied to get data back. Date ranges being a common one. Cantaloupe's error messages are fairly clear, in my experience, with telling you what parameteres are needed to run the report and in what format they should be. First element of tuple is filter name and second is filter value. Filter names are in format of "filter0", "filter1", "filter2", etc.

Snowflake

Cantaloupe also offers a data warehouse product in Snowflake. Good for aggregating lots of information, as well as pulling historical info. However, notably, data is only pushed from Seed into the Snowflake data warehouse once a day, so it is not necessarily going to be accurate as of that moment.

Also something to keep in mind is that the system makes use of SCD (slowly changing dimension) in order to keep track of historical info vs current info. So some care should be taken when interpreting the data. For each dataset that uses SCD, a parameter has been included to restrict to current data only or include all data.

Authentication to Snowflake is handled via key-pair authentication. You'll need to create a key pair using openssl and set the snowflake user's RSA_PUBLIC_KEY.

Prepick

Cantaloupe has a SOAP interface that allows picking software to fulfill, update, and finish prepick orders. Typically the SOAP interface would be used directly by that picking system (e.g. Lightspeed) rather than via python, but may be useful for some specific circumstances. Don't have access to the SOAP interface currently, so module may or may not be working.

The expected flow would be something along these lines (from Cantaloupe's documentation):

  1. Pull in Master Data/lists

    a. LoadItemCategories

    b. LoadItems

    c. LoadMachineClasses

    d. LoadRoutes

  2. Pull in the orders for the next day by route

    a. LoadPrepick (Date, Route)

  3. Complete each pick in the warehouse then send back any updates

    a. UpdatePrepick (Schedule, Machine, Coil, Item, Quantity)

  4. When each route is complete, notify Seed the schedule can be locked for that route

    a. FinishPrepickUpdate (Schedule)

Metadata

Release files for clope 1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clope 1.1
File Size Uploaded
clope-1.1.tar.gz 18.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clope 1.1
File Interpreter ABI Platform
clope-1.1-py3-none-any.whl Python 3 none any Details

Total release size: 41.1 kB

Release files / clope-1.1.tar.gz

Download URL clope-1.1.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9c87c207f81f1fce29c759761df4f5c79bf929970d96697ce15c0218a3bd8deb
BLAKE2b-256 checksum
How to use checksums
65b93686f672194fb8f681fe0654de2f67b8008fb6ec39d8692379e2e088b90d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.16 {"installer":{"name":"uv","version":"0.12.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / clope-1.1-py3-none-any.whl

Download URL clope-1.1-py3-none-any.whl
Size 22.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70d0cd0161950d124dc6201dbcbbc29f55cbf180205ab9f083fed19824431d54
BLAKE2b-256 checksum
How to use checksums
df92b49e93020a18083e8ff424a227159cd19e381f94e21123092683d7d59887
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.16 {"installer":{"name":"uv","version":"0.12.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

1.1 This release

2 release files

1.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page