malepati/custom_template_working
0
1"""2Test script to verify the data fetching logic in create_presentation endpoint.3This sends a JSON payload with user_id and list_of_queries to the /create endpoint.4"""5import requests6import json7 8# The sample payload provided by the user9payload_data = {10 "reportname": "visa dataset report",11 "user_id": "e23221ad-85f0-4fc6-88ec-1aad756a93e3",12 "list_of_queries": [13 "95c31c12-eb34-4693-83d2-26dcd2052add",14 "9ef79582-149a-4674-bc51-b0348d9991dd",15 "50277736-0662-4a76-9437-51d1ac2f51dd",16 "8322d846-fb00-49c3-9ca9-8af23ab684dd",17 "2bf48d89-67e2-45f8-8c3d-6e83ea696add"18 ],19 "template_filename": "Untitled design (1).docx",20 "Description": "Generate comprehensive data analysis report."21}22 23# Convert to JSON string (this is what the backend expects in the 'content' field)24content_json = json.dumps(payload_data)25 26# The request body for the /create endpoint27request_body = {28 "content": content_json, # JSON string goes here29 "n_slides": 10,30 "language": "English"31}32 33# Send the request34url = "http://127.0.0.1:8000/api/v1/ppt/presentation/create"35print(f"Sending request to: {url}")36print(f"Request body content field: {content_json[:100]}...")37 38try:39 response = requests.post(url, json=request_body)40 print(f"\nStatus Code: {response.status_code}")41 print(f"Response: {json.dumps(response.json(), indent=2)}")42except Exception as e:43 print(f"Error: {e}")44 