ambrosfitz commited on
Commit
7f71865
1 Parent(s): e7baaa3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -5,9 +5,14 @@ import json
5
  API_URL = "https://sendthat.cc"
6
 
7
  def list_indexes():
8
- url = f"{API_URL}/list_indexes"
9
- response = requests.get(url)
10
- return response.json()
 
 
 
 
 
11
 
12
  def search_document(index_name, query, k):
13
  url = f"{API_URL}/search/{index_name}"
 
5
  API_URL = "https://sendthat.cc"
6
 
7
  def list_indexes():
8
+ try:
9
+ url = f"{API_URL}/list_indexes"
10
+ response = requests.get(url)
11
+ response.raise_for_status() # This will raise an exception for HTTP errors
12
+ return response.json()
13
+ except requests.exceptions.RequestException as e:
14
+ print(f"Error fetching indexes: {e}")
15
+ return ["Error fetching indexes"] # Return a list with an error message
16
 
17
  def search_document(index_name, query, k):
18
  url = f"{API_URL}/search/{index_name}"