A robust Python SDK for slurpit
Project description
Slurpit SDK
The Slurpit SDK is a Python package for interacting with the Slurpit API, enabling developers to easily manage devices and planning resources. It is designed for simplicity and flexibility, offering methods for listing devices, retrieving planning data, and exporting information to CSV format.
Installation
You can install the Slurpit SDK using pip with the following command:
pip install slurpit_sdk
Alternatively, if you prefer to install from source, clone the repository and run the setup script:
git clone https://gitlab.com/slurpit.io/slurpit_sdk.git
cd slurpit
python setup.py install
Quick Start
To use the SDK, start by importing the package and setting up the API client:
import slurpit
api = slurpit.api(
url="http://localhost:8000",
api_key="1234567890abcdefghijklmnopqrstuvwxqz"
)
Replace the url
and api_key
with the URL of your Slurpit instance and your API key respectively.
Working with Devices
Retrieve and print the hostnames of all devices:
devices = api.device.get_devices()
for device in devices:
print(device.hostname)
Exporting Data to CSV
To export planning data to a CSV file:
plannings_csvdata = api.planning.get_plannings(export_csv=True)
result = api.device.save_csv_bytes(plannings_csvdata, "csv/plannings.csv")
Exporting Data as Pandas DataFrame
To export planning data as a pandas dataframe
plannings_df = api.planning.get_plannings(export_df=True)
Pagination
Handle large sets of devices with pagination:
devices = api.device.get_devices(offset=100, limit=1000)
for device in devices:
print(device.hostname)
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 slurpit_sdk-0.9.55.tar.gz
.
File metadata
- Download URL: slurpit_sdk-0.9.55.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.0 Linux/6.8.0-48-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a52f81e810e7c1ef3f78afbcd231333a996977e3340a57f85ee6a138f54ffab |
|
MD5 | 2178c0e542244ef19f97c362584ce44c |
|
BLAKE2b-256 | 138b674e021285ac5a0ea2c0c6972d2ff1daa48ced21a695be55dd1e3de5dc7f |
File details
Details for the file slurpit_sdk-0.9.55-py3-none-any.whl
.
File metadata
- Download URL: slurpit_sdk-0.9.55-py3-none-any.whl
- Upload date:
- Size: 27.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.0 Linux/6.8.0-48-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 149973d26c9c2b47995772a328777f987beb1bde03bdfc066edfd73d5d34eb0a |
|
MD5 | 8cb5cfa338994fe97e2520442b56874b |
|
BLAKE2b-256 | b084e0d42c5cc94959c285536fd3408cad8547b3ec5fc5510a1236f04cdce64c |