from morphik import Morphik
db = Morphik()
# Check document processing status
status = db.get_document_status("doc_123abc")
print(f"Status: {status.get('status')}")
if status.get('error'):
print(f"Error: {status.get('error')}")
# Use in a polling loop
import time
while True:
status = db.get_document_status("doc_123abc")
if status.get('status') == 'completed':
print("Document processing complete!")
break
elif status.get('status') == 'failed':
print(f"Document processing failed: {status.get('error')}")
break
time.sleep(2)