This module provides a simple Python interface to interact with the Serial API. It allows you to easily perform common operations such as uploading process data, initializing identifiers, and checking the server connection.
Project description
Overview
This module provides a partial Python SDK for interacting with Serial's API. If you need to perform actions not provided in the SDK, please reference the API documentation. If neither the API nor the library provides you with the necessary tools, please contact Serial Support. The latest version of the library can be downloaded here.
Installation
Clone the repository from GitHub or install via pip:
git clone https://https://github.com/serialmfg/serial-py.git
or
pip install serialmfg
Dependencies
This project requires the following dependencies:
- requests
Example Usage
-
Get an API key from your Serial account or admin.
-
(Optionally) Generate a station ID from process builder in the serial web app.
-
Implement your script:
import serialmfg as serial
serial.set_station_id('YOUR_STATION_ID')
serial.set_api_key('YOUR_API_KEY')
# ----------- Component Instances ----------- #
# Creating a component instance
my_component_instance = serial.ComponentInstances.create(identifier="ABC-1234", component_name="Component Name")
# Getting a component instance
my_component_instance_2 = serial.ComponentInstances.get(identifier="XYZ-5678")
# Listing component instances
defective_components = serial.ComponentInstances.list({"status": "DEFECTIVE"})
# ----------- Process Entries ----------- #
# Creating a process entry
my_process_entry = serial.ProcessEntries.create(process_id="process-id", component_instance_identifier="ABC-1234")
# Adding data to a process entry
my_process_entry.add_text(dataset_name="Foo", value="bar")
my_process_entry.add_number(dataset_name="Pi Approx", value=3.141, lsl=3.1, usl=3.2)
my_process_entry.add_boolean(dataset_name="Pass Fail Criteria", value=True, expected_value=True)
my_process_entry.add_file(dataset_name="Oven Temperatures", path="/Users/me/Downloads/oven-temp.csv", file_name="oven-temp-todays-date.csv")
my_process_entry.add_image(dataset_name="Cat Pictures", path="/Users/me/Documents/my-cat.png", file_name="jerry.png")
my_process_entry.add_link(dataset_name="Link Child 1", child_identifier="XYZ-5678")
# Submitting a process entry
my_process_entry.submit(cycle_time=42, is_pass=False) #Optionally add cycle_time or process result override
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
Built Distribution
File details
Details for the file serialmfg-1.3.0.tar.gz
.
File metadata
- Download URL: serialmfg-1.3.0.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f4566b6dd0ff5c1a7210a79822679cad625ea579a6b06fd3ce182aa5b384515 |
|
MD5 | e23ab124fe34ac456e4e5544f5a14ef7 |
|
BLAKE2b-256 | bad51741187a8e9b46b3cf798780f26d93e128a3f1b2d591e47de6c41fc5011a |
File details
Details for the file serialmfg-1.3.0-py3-none-any.whl
.
File metadata
- Download URL: serialmfg-1.3.0-py3-none-any.whl
- Upload date:
- Size: 22.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 221ee869656813ea6d2357653d8d31810ea974b653c8a4d9987b8108c08fede2 |
|
MD5 | ee671c7d68f7176ea8a6ca8d18c215ac |
|
BLAKE2b-256 | 7976800ece4085097f8648028dc9e5390c56f531711d104342cc444a40809326 |