Package to simplify Micantis API usage
Project description
Micantis API Wrapper
A lightweight Python wrapper for interacting with the Micantis API plus some helpful utilities.
Built for ease of use, fast prototyping, and clean integration into data workflows.
🚀 Features
- Authenticate and connect to the Micantis API service
- Download and parse csvs and binary data into pandas DataFrames
- Filter, search, and retrieve metadata
- Utility functions to simplify common API tasks
⚠️ Important
This package is designed for authenticated Micantis customers only.
If you are not a Micantis customer, the API wrapper and utilities in this package will not work for you.
For more information on accessing the Micantis API, please contact us at info@micantis.io.
📦 Installation
pip install micantis
💻 Examples
Import functions
import pandas as pd
from micantis import MicantisAPI
Initialize API
# Option 1 - login with username and password
service_url = 'your service url'
username = 'your username'
password = 'your password'
api = MicantisAPI(service_url=service_url, username=username, password=password)
# Option 2 - login in with Microsoft Entra ID
SERVICE = 'your service url'
CLIENT_ID = 'your client id'
AUTHORITY = 'https://login.microsoftonline.com/organizations'
SCOPES = ['your scopes']
api = MicantisAPI(service_url=SERVICE, client_id=CLIENT_ID, authority=AUTHORITY, scopes=SCOPES)
Authenticate API
api.authenticate()
Download Data Table Summary
Optional parameters
search: Search string (same syntax as the Micantis WebApp)barcode: Search for a specific barcodelimit: Number of results to return (default: 500)min_date: Only return results after this datemax_date: Only return results before this dateshow_ignored: Include soft-deleted files (default:True)
table = api.get_data_table(search=search, barcode=barcode, min_date=min_date, max_date=max_date, limit = 10, show_ignored=show_ignored)
table
Download Binary Files
# Download single file
file_id = 'File ID obtained from data table, id column'
df = api.download_binary_file(id)
# Download many files using list of files from the table
file_id_list = table['id'].to_list()
data = []
for id in file_id_list:
df = api.download_csv_file(id)
data.append(df)
all_data = pd.concat(data)
Download CSV Files
# Download single file
file_id = 'File ID obtained from data table, id column'
df = api.download_csv_file(id)
# Download multiple files
id_list = table['id'].to_list()
data = []
for id in id_list:
df = api.download_csv_file(id)
data.append(df)
all_data = pd.concat(data)
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file micantis-0.1.0.tar.gz.
File metadata
- Download URL: micantis-0.1.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8df8e4f8b13833fd7f812d5b5f9b23198a5c32cfe4c4bab9ce067f4593ab0c84
|
|
| MD5 |
84b1eab1a13d3f34286b3e1e6aecd486
|
|
| BLAKE2b-256 |
19dff5bb1ea76196e92f5702c54523395a45c5f12a0a0c40c95f492aae1094c4
|
File details
Details for the file micantis-0.1.0-py3-none-any.whl.
File metadata
- Download URL: micantis-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f40c5b9d390a254a79186ac5e3a921bb5f14538d666e4548787259195d0cb82
|
|
| MD5 |
be2ba1df7a64bfb7413daadab7d2e529
|
|
| BLAKE2b-256 |
0ce9cee5ca11b6673f68b3048716e0e1b3fa80aaa4e92c3a14b9a6961a72e7d5
|