File size: 985 Bytes
171eb01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
32
33
import requests
import os

url = "http://localhost:8000/api/report/"
payload = {
    "text": "Verification text for PDF report generation.",
    "score": 99.9,
    "label": "AI Generated"
}

try:
    print("Requesting PDF report...")
    response = requests.post(url, json=payload)
    
    if response.status_code == 200:
        content_size = len(response.content)
        print(f"Success! Received {content_size} bytes.")
        
        # Check for PDF header
        if response.content.startswith(b"%PDF"):
            print("Valid PDF header found.")
            with open("verification_report.pdf", "wb") as f:
                f.write(response.content)
            print("Saved 'verification_report.pdf' for inspection.")
        else:
            print("ERROR: Response is not a valid PDF (missing header).")
    else:
        print(f"Failed with Status Code: {response.status_code}")
        print(response.text)

except Exception as e:
    print(f"Connection Error: {e}")