Update app.py
Browse files
app.py
CHANGED
@@ -119,14 +119,16 @@ with col1:
|
|
119 |
st.header("Input")
|
120 |
target_url = st.text_input("Enter the target URL")
|
121 |
|
|
|
|
|
122 |
generate_button = st.sidebar.button("Generate All")
|
123 |
reset_button = st.sidebar.button("Reset")
|
124 |
|
125 |
-
|
126 |
-
|
127 |
-
# Generate CSV and download button
|
128 |
if generate_button and target_url:
|
129 |
df = get_backlinks(api_login, api_key, target_url, filters)
|
|
|
|
|
130 |
if df is not None:
|
131 |
csv = convert_df_to_csv(df)
|
132 |
st.download_button(
|
@@ -135,7 +137,7 @@ if generate_button and target_url:
|
|
135 |
file_name='backlinks.csv',
|
136 |
mime='text/csv',
|
137 |
)
|
138 |
-
|
139 |
st.error("Failed to generate CSV: No data returned from the API or data processing error.")
|
140 |
|
141 |
# Reset functionality
|
|
|
119 |
st.header("Input")
|
120 |
target_url = st.text_input("Enter the target URL")
|
121 |
|
122 |
+
# Variables for control flow
|
123 |
+
df = None
|
124 |
generate_button = st.sidebar.button("Generate All")
|
125 |
reset_button = st.sidebar.button("Reset")
|
126 |
|
127 |
+
# Generate CSV and download button logic
|
|
|
|
|
128 |
if generate_button and target_url:
|
129 |
df = get_backlinks(api_login, api_key, target_url, filters)
|
130 |
+
|
131 |
+
with col2:
|
132 |
if df is not None:
|
133 |
csv = convert_df_to_csv(df)
|
134 |
st.download_button(
|
|
|
137 |
file_name='backlinks.csv',
|
138 |
mime='text/csv',
|
139 |
)
|
140 |
+
elif df is None and generate_button:
|
141 |
st.error("Failed to generate CSV: No data returned from the API or data processing error.")
|
142 |
|
143 |
# Reset functionality
|