EtuDataProc is a Python library designed to simplify interaction with a queue service API. It provides methods for authentication, sending codes to the queue, retrieving results, checking queue positions, and canceling tasks. This README serves as a guide to using the QueueClient library effectively.
Install the current version with PyPI:
pip install etudataprocOr from Github:
pip install https://github.com/sesh00/etudataproc/archive/main.zipTo use QueueClient in your Python code, import it as follows:
from etudataproc import QueueClientYou can initialize a QueueClient object by providing the base URL of the queue service and optionally the authentication token.
queue_client = QueueClient(base_url="https://your-queue-service-url.com", token="your-auth-token")You can authenticate with the queue service using your username and password.
queue_client.authenticate(username="your-username", password="your-password")To send a code to the queue, use the send_code() method.
code = "your-code-to-be-sent"
queue_client.send_code(code)To retrieve the result of a task from the queue, use the get_result() method.
result = queue_client.get_result()You can check your position in the queue using the get_queue_position() method.
position = queue_client.get_queue_position()To cancel a task in the queue, use the cancel_task() method.
queue_client.cancel_task()
queue_client.cancel_task()If authentication or token-related errors occur, QueueClient raises an Exception with an appropriate error message. Ensure to handle these exceptions appropriately in your code.
Here's a simple example demonstrating the usage of QueueClient:
from etudataproc import QueueClient
queue_client = QueueClient(base_url="https://your-queue-service-url.com")
queue_client.authenticate(username="your-username", password="your-password")
code = "your-code-to-be-sent"
queue_client.send_code(code)
result = queue_client.get_result()
print("Task Result:", result)
position = queue_client.get_queue_position()
print("Queue Position:", position)
queue_client.cancel_task()Contributions to EtuDataProc are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on the GitHub repository.
The module is available as open source under the terms of the MIT License