Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +15 -6
src/streamlit_app.py
CHANGED
|
@@ -11,7 +11,7 @@ import numpy as np
|
|
| 11 |
# =============================================================================
|
| 12 |
# CONFIGURATION - Using Secrets Management
|
| 13 |
# =============================================================================
|
| 14 |
-
NOCODB_URL = "https://mtoft20-potm.hf.space/api/v1/db/data/noco/p9pozkcw81t9aee" #
|
| 15 |
|
| 16 |
# Get sensitive data from Streamlit secrets or environment variables
|
| 17 |
def get_api_credentials():
|
|
@@ -63,10 +63,18 @@ def get_streaming_content():
|
|
| 63 |
try:
|
| 64 |
while True:
|
| 65 |
offset = (page - 1) * page_size
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
if response.status_code == 200:
|
| 72 |
data = response.json()
|
|
@@ -90,7 +98,8 @@ def get_streaming_content():
|
|
| 90 |
return all_content
|
| 91 |
|
| 92 |
except Exception as e:
|
| 93 |
-
st.error(f"Error connecting to database: {e}")
|
|
|
|
| 94 |
return []
|
| 95 |
|
| 96 |
def filter_content(content_list, filters):
|
|
|
|
| 11 |
# =============================================================================
|
| 12 |
# CONFIGURATION - Using Secrets Management
|
| 13 |
# =============================================================================
|
| 14 |
+
NOCODB_URL = "https://mtoft20-potm.hf.space/api/v1/db/data/noco/p9pozkcw81t9aee/cleaned_combined_streaming" # Updated URL
|
| 15 |
|
| 16 |
# Get sensitive data from Streamlit secrets or environment variables
|
| 17 |
def get_api_credentials():
|
|
|
|
| 63 |
try:
|
| 64 |
while True:
|
| 65 |
offset = (page - 1) * page_size
|
| 66 |
+
url = f"{NOCODB_URL}?limit={page_size}&offset={offset}"
|
| 67 |
+
|
| 68 |
+
# Debug information
|
| 69 |
+
st.write(f"Attempting to fetch data from: {url}")
|
| 70 |
+
st.write(f"With headers: {headers}")
|
| 71 |
+
|
| 72 |
+
response = requests.get(url, headers=headers)
|
| 73 |
+
|
| 74 |
+
# Debug response
|
| 75 |
+
st.write(f"Response status code: {response.status_code}")
|
| 76 |
+
if response.status_code != 200:
|
| 77 |
+
st.write(f"Response content: {response.text}")
|
| 78 |
|
| 79 |
if response.status_code == 200:
|
| 80 |
data = response.json()
|
|
|
|
| 98 |
return all_content
|
| 99 |
|
| 100 |
except Exception as e:
|
| 101 |
+
st.error(f"Error connecting to database: {str(e)}")
|
| 102 |
+
st.write("Full error details:", e)
|
| 103 |
return []
|
| 104 |
|
| 105 |
def filter_content(content_list, filters):
|