Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files
app.py
CHANGED
|
@@ -16,7 +16,15 @@ def query_financial_data(company_name, query_type):
|
|
| 16 |
json={"company_input": company_name},
|
| 17 |
timeout=30
|
| 18 |
)
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
if company.get("error"):
|
| 22 |
return f"β ιθ――: {company['error']}"
|
|
@@ -34,7 +42,14 @@ def query_financial_data(company_name, query_type):
|
|
| 34 |
json={"cik": cik},
|
| 35 |
timeout=30
|
| 36 |
)
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
if data.get("error"):
|
| 40 |
return result + f"β {data['error']}"
|
|
@@ -51,7 +66,14 @@ def query_financial_data(company_name, query_type):
|
|
| 51 |
json={"cik": cik, "years": 3},
|
| 52 |
timeout=60
|
| 53 |
)
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
if metrics.get("error"):
|
| 57 |
return result + f"β {metrics['error']}"
|
|
@@ -77,7 +99,14 @@ def query_financial_data(company_name, query_type):
|
|
| 77 |
json={"cik": cik, "years": 5},
|
| 78 |
timeout=60
|
| 79 |
)
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
if metrics.get("error"):
|
| 83 |
return result + f"β {metrics['error']}"
|
|
|
|
| 16 |
json={"company_input": company_name},
|
| 17 |
timeout=30
|
| 18 |
)
|
| 19 |
+
|
| 20 |
+
# ζ£ζ₯εεΊηΆζ
|
| 21 |
+
if search_resp.status_code != 200:
|
| 22 |
+
return f"β Server Error: HTTP {search_resp.status_code}\n\nResponse: {search_resp.text[:500]}"
|
| 23 |
+
|
| 24 |
+
try:
|
| 25 |
+
company = search_resp.json()
|
| 26 |
+
except ValueError as e:
|
| 27 |
+
return f"β JSON Parse Error: {str(e)}\n\nResponse Text: {search_resp.text[:500]}"
|
| 28 |
|
| 29 |
if company.get("error"):
|
| 30 |
return f"β ιθ――: {company['error']}"
|
|
|
|
| 42 |
json={"cik": cik},
|
| 43 |
timeout=30
|
| 44 |
)
|
| 45 |
+
|
| 46 |
+
if data_resp.status_code != 200:
|
| 47 |
+
return result + f"β Server Error: HTTP {data_resp.status_code}\n\n{data_resp.text[:500]}"
|
| 48 |
+
|
| 49 |
+
try:
|
| 50 |
+
data = data_resp.json()
|
| 51 |
+
except ValueError as e:
|
| 52 |
+
return result + f"β JSON Parse Error: {str(e)}\n\n{data_resp.text[:500]}"
|
| 53 |
|
| 54 |
if data.get("error"):
|
| 55 |
return result + f"β {data['error']}"
|
|
|
|
| 66 |
json={"cik": cik, "years": 3},
|
| 67 |
timeout=60
|
| 68 |
)
|
| 69 |
+
|
| 70 |
+
if metrics_resp.status_code != 200:
|
| 71 |
+
return result + f"β Server Error: HTTP {metrics_resp.status_code}\n\n{metrics_resp.text[:500]}"
|
| 72 |
+
|
| 73 |
+
try:
|
| 74 |
+
metrics = metrics_resp.json()
|
| 75 |
+
except ValueError as e:
|
| 76 |
+
return result + f"β JSON Parse Error: {str(e)}\n\n{metrics_resp.text[:500]}"
|
| 77 |
|
| 78 |
if metrics.get("error"):
|
| 79 |
return result + f"β {metrics['error']}"
|
|
|
|
| 99 |
json={"cik": cik, "years": 5},
|
| 100 |
timeout=60
|
| 101 |
)
|
| 102 |
+
|
| 103 |
+
if metrics_resp.status_code != 200:
|
| 104 |
+
return result + f"β Server Error: HTTP {metrics_resp.status_code}\n\n{metrics_resp.text[:500]}"
|
| 105 |
+
|
| 106 |
+
try:
|
| 107 |
+
metrics = metrics_resp.json()
|
| 108 |
+
except ValueError as e:
|
| 109 |
+
return result + f"β JSON Parse Error: {str(e)}\n\n{metrics_resp.text[:500]}"
|
| 110 |
|
| 111 |
if metrics.get("error"):
|
| 112 |
return result + f"β {metrics['error']}"
|