File size: 895 Bytes
86fce4f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
"""

Test the conversion endpoint

"""

import requests
import json

def test_conversion():
    url = "http://localhost:8000/convert"
    
    # Test with our test document
    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()