Skip to main content

A Python SDK for interacting with the qube REST API and subscribing to real-time events

Project description

qube-python

Qube SDK is a Python library designed for seamless interaction with the Qube REST API and subscribing to real-time events. This SDK simplifies ticket and queue management while providing an easy-to-use interface for developers.

Installation

You can install the SDK using Poetry:

poetry add pyqube

Example Usage

Here’s a brief example demonstrating how you can use the Qube SDK to interact with both the Qube API and Event Handling:

Events

import time
from pyqube import QubeClient
from pyqube.types import Ticket


def main():
    qube_client = QubeClient(api_key="your_api_key_here", location_id=1)

    @qube_client.on_ticket_generated()
    def handle_generated_ticket(ticket: Ticket):
        print(f"Generated ticket: {ticket}")

    print("Listening for events. Press Ctrl+C to exit.")
    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        qube_client.disconnect()


if __name__ == "__main__":
    main()

REST API

from pyqube import QubeClient


def generate_ticket_for_each_queue(qube_client):
    pages_with_queues = qube_client.get_queue_management_manager().list_queues()
    # pages_with_queues is a list of pages, each page contains a list of queues
    for page in pages_with_queues:
        # each item is a page with multiple queues
        for queue in page:
            qube_client.get_queue_management_manager().set_queue_status(queue.id, True)
            generated_ticket = qube_client.get_queue_management_manager().generate_ticket(queue.id, False)
            print(generated_ticket)


if __name__ == '__main__':
    qube_client = QubeClient(api_key="your_api_key_here", location_id=1)
    generate_ticket_for_each_queue(qube_client)

Explore additional usage examples and detailed workflows in the examples directory.

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

pyqube-0.1.0.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

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

pyqube-0.1.0-py3-none-any.whl (38.0 kB view details)

Uploaded Python 3

File details

Details for the file pyqube-0.1.0.tar.gz.

File metadata

  • Download URL: pyqube-0.1.0.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.6

File hashes

Hashes for pyqube-0.1.0.tar.gz
Algorithm Hash digest
SHA256 60591816d8cca299f361f6b23774af7aea0f15198f46b801f34c8dba6cacdd2f
MD5 ef8e1e0d9217e50d848e6601026157be
BLAKE2b-256 75752f76724efa32dafeb34cfb5d7c7d5f1b75a6548ef30191b210f42fa85e80

See more details on using hashes here.

File details

Details for the file pyqube-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyqube-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 38.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.6

File hashes

Hashes for pyqube-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb8685daa5595f26a5a10a28841a6e20501de76dcf462648d297577d5d86f041
MD5 7e35259659a53b14d71eaf0c00eb76dc
BLAKE2b-256 511540adbc34e4ecdd5885a812409ff73cc2251f0c2a74073c94b944d857dc2d

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