Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slurpit_sdk-0.9.113.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slurpit_sdk-0.9.113-py3-none-any.whl (31.1 kB view details)

Uploaded Python 3

File details

Details for the file slurpit_sdk-0.9.113.tar.gz.

File metadata

  • Download URL: slurpit_sdk-0.9.113.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Linux/6.8.0-55-generic

File hashes

Hashes for slurpit_sdk-0.9.113.tar.gz
Algorithm Hash digest
SHA256 22cf5567797b1d385f6f428c3e1e7832774bc516377501e94b0ae2740017ff3c
MD5 1af7a2cb8e7c82f9f1d0f06f8e56ab1c
BLAKE2b-256 9c0fa229e6789da45ce6b614b512a8a7feaa614195437c2f03b1c41671b2216f

See more details on using hashes here.

File details

Details for the file slurpit_sdk-0.9.113-py3-none-any.whl.

File metadata

  • Download URL: slurpit_sdk-0.9.113-py3-none-any.whl
  • Upload date:
  • Size: 31.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Linux/6.8.0-55-generic

File hashes

Hashes for slurpit_sdk-0.9.113-py3-none-any.whl
Algorithm Hash digest
SHA256 6228d66b57f2d9e7cd979a23a771d36b229ab2b9c018e6b4a976873ba4dcaac0
MD5 7fe72cb0073c18d2d5076637b392e3ff
BLAKE2b-256 3d908d7953f211e2fcf0efeb1359c16a978e2d84e0d8f9e65bf8f3429a385c51

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page