|
|
|
|
|
"""
|
|
|
Test the conversion endpoint
|
|
|
"""
|
|
|
|
|
|
import requests
|
|
|
import json
|
|
|
|
|
|
def test_conversion():
|
|
|
url = "http://localhost:8000/convert"
|
|
|
|
|
|
|
|
|
with open("test_document.docx", "rb") as f:
|
|
|
files = {"file": ("test_document.docx", f, "application/vnd.openxmlformats-officedocument.wordprocessingml.document")}
|
|
|
response = requests.post(url, files=files)
|
|
|
|
|
|
print(f"Status Code: {response.status_code}")
|
|
|
print(f"Response: {response.text}")
|
|
|
|
|
|
if response.status_code == 200:
|
|
|
data = response.json()
|
|
|
print(f"Success: {data.get('success')}")
|
|
|
print(f"Message: {data.get('message')}")
|
|
|
if 'pdf_url' in data:
|
|
|
print(f"PDF URL: {data['pdf_url']}")
|
|
|
else:
|
|
|
print(f"Error: {response.text}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
test_conversion()
|
|
|
|