Update app.py
Browse files
app.py
CHANGED
@@ -33,10 +33,11 @@ def get_backlinks(api_login, api_key, target_url, filters):
|
|
33 |
if response.status_code == 200 and 'results' in response.json():
|
34 |
# Extract the results
|
35 |
results = response.json()['results']
|
36 |
-
# Check if results are not empty
|
37 |
if results:
|
38 |
-
#
|
39 |
-
|
|
|
|
|
40 |
return df
|
41 |
else:
|
42 |
st.error("Received empty data from API.")
|
@@ -96,10 +97,9 @@ reset_button = st.sidebar.button("Reset")
|
|
96 |
if generate_button and target_url:
|
97 |
df = get_backlinks(api_login, api_key, target_url, filters)
|
98 |
if df is not None:
|
99 |
-
# Display the DataFrame in the second column
|
100 |
with col2:
|
101 |
st.header("Output")
|
102 |
-
st.dataframe(df)
|
103 |
|
104 |
# Reset functionality
|
105 |
if reset_button:
|
|
|
33 |
if response.status_code == 200 and 'results' in response.json():
|
34 |
# Extract the results
|
35 |
results = response.json()['results']
|
|
|
36 |
if results:
|
37 |
+
# Assuming 'results' contains a list of backlink information,
|
38 |
+
# we need to convert this list to a DataFrame.
|
39 |
+
# Modify the line below according to the actual structure of 'results'
|
40 |
+
df = pd.json_normalize(results) # Adjust this line as per the actual JSON structure
|
41 |
return df
|
42 |
else:
|
43 |
st.error("Received empty data from API.")
|
|
|
97 |
if generate_button and target_url:
|
98 |
df = get_backlinks(api_login, api_key, target_url, filters)
|
99 |
if df is not None:
|
|
|
100 |
with col2:
|
101 |
st.header("Output")
|
102 |
+
st.dataframe(df) # This will display the DataFrame as a table
|
103 |
|
104 |
# Reset functionality
|
105 |
if reset_button:
|