Skip to content

Commit 3eab338

Browse files
authored
Update research_api.py
removing trailing whitespace and shortening long lines
1 parent d51d22e commit 3eab338

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

api/research_api.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,16 @@ def post(self):
7272

7373
# Construct API response
7474
return {
75-
"topic": structured_response.topic, # Research topic title
76-
"summary": html_summary, # HTML-formatted content
77-
"sources": structured_response.sources, # Reference URLs
78-
"tools": structured_response.tools_used, # AI tools utilized
79-
"download_link": f"/download/{filename}", # File access endpoint
75+
"topic": structured_response.topic,
76+
# Research topic title
77+
"summary": html_summary,
78+
# HTML-formatted content
79+
"sources": structured_response.sources,
80+
# Reference URLs
81+
"tools": structured_response.tools_used,
82+
# AI tools utilized
83+
"download_link": f"/download/{filename}",
84+
# File access endpoint
8085
"processing_time": round(
8186
time.time() - start_time, 2
8287
), # Duration in seconds
@@ -87,7 +92,8 @@ def post(self):
8792
print("Error in /research:", e) # Server-side logging
8893
return {
8994
"error": str(e), # Developer-facing message
90-
"details": "Check server logs for more information", # User guidance
95+
"details": "Check server logs for more information",
96+
# User guidance
9197
}, 500 # HTTP 500 Internal Server Error
9298

9399

@@ -109,7 +115,8 @@ def get(self, filename):
109115
- Enable authentication in production
110116
"""
111117
# Configure secure download path
112-
downloads_folder = os.path.join(os.getcwd(), "outputs") # Isolate files
118+
downloads_folder = os.path.join(os.getcwd(), "outputs")
119+
# Isolate files
113120

114121
# Safe file serving with Flask's send_from_directory
115122
return send_from_directory(
@@ -122,7 +129,7 @@ def get(self, filename):
122129
"""
123130
API Security Notes:
124131
1. Authentication: Currently disabled (enable method_decorators for JWT)
125-
2. Input Validation:
132+
2. Input Validation:
126133
- Research endpoint validates query exists
127134
- Download endpoint needs filename sanitization
128135
3. File Security:

0 commit comments

Comments
 (0)