33 lines
940 B
Python
Executable File
33 lines
940 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""Query Queue disk space and optionally inspect a Store conversation."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
from bongo.store.QueueClient import QueueClient
|
|
|
|
|
|
queue = QueueClient()
|
|
try:
|
|
print("Queue disk space:", queue.Diskspace())
|
|
finally:
|
|
queue.Quit()
|
|
|
|
conversation = os.environ.get("BONGO_TEST_CONVERSATION")
|
|
if conversation:
|
|
from bongo.store.StoreClient import StoreClient
|
|
|
|
user = os.environ.get("BONGO_TEST_USER", "")
|
|
password = os.environ.get("BONGO_TEST_PASSWORD", "")
|
|
if not user or not password:
|
|
raise SystemExit(
|
|
"BONGO_TEST_USER and BONGO_TEST_PASSWORD are required for Store")
|
|
client = StoreClient(user, user, authPassword=password)
|
|
try:
|
|
for item in client.Conversation(conversation):
|
|
print(item.uid, item.type, item.flags, item.imapuid,
|
|
item.bodylen, item.filename)
|
|
finally:
|
|
client.Quit()
|