Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import pandas as pd
|
|
3 |
import requests
|
4 |
import base64
|
5 |
|
6 |
-
def get_backlinks(api_login, api_key, target_url, filters
|
7 |
# Encoding credentials
|
8 |
encoded_credentials = base64.b64encode(f"{api_login}:{api_key}".encode()).decode()
|
9 |
|
@@ -18,8 +18,7 @@ def get_backlinks(api_login, api_key, target_url, filters, include_subdomains):
|
|
18 |
"target": target_url,
|
19 |
"limit": 1000,
|
20 |
"mode": "as_is",
|
21 |
-
"filters": filters
|
22 |
-
"include_subdomains": include_subdomains # Adding the include_subdomains filter
|
23 |
}
|
24 |
}
|
25 |
|
@@ -80,7 +79,7 @@ is_lost = st.sidebar.checkbox("Is Lost", value=False)
|
|
80 |
dofollow = st.sidebar.checkbox("Dofollow", value=True)
|
81 |
backlink_spam_score = st.sidebar.slider("Backlink Spam Score ≤", 0, 100, 10)
|
82 |
page_from_language = st.sidebar.selectbox("Page From Language", ['en', 'other'])
|
83 |
-
|
84 |
|
85 |
# Prepare filters for API call
|
86 |
filters = []
|
@@ -98,6 +97,10 @@ if dofollow:
|
|
98 |
filters.append(["dofollow", "=", dofollow])
|
99 |
filters.append("and")
|
100 |
|
|
|
|
|
|
|
|
|
101 |
filters.append(["backlink_spam_score", "<=", backlink_spam_score])
|
102 |
filters.append("and")
|
103 |
filters.append(["page_from_language", "=", page_from_language])
|
@@ -120,7 +123,7 @@ df = None
|
|
120 |
|
121 |
# Generate CSV and download button
|
122 |
if generate_button and target_url:
|
123 |
-
df = get_backlinks(api_login, api_key, target_url, filters
|
124 |
if df is not None:
|
125 |
csv = convert_df_to_csv(df)
|
126 |
st.download_button(
|
|
|
3 |
import requests
|
4 |
import base64
|
5 |
|
6 |
+
def get_backlinks(api_login, api_key, target_url, filters):
|
7 |
# Encoding credentials
|
8 |
encoded_credentials = base64.b64encode(f"{api_login}:{api_key}".encode()).decode()
|
9 |
|
|
|
18 |
"target": target_url,
|
19 |
"limit": 1000,
|
20 |
"mode": "as_is",
|
21 |
+
"filters": filters
|
|
|
22 |
}
|
23 |
}
|
24 |
|
|
|
79 |
dofollow = st.sidebar.checkbox("Dofollow", value=True)
|
80 |
backlink_spam_score = st.sidebar.slider("Backlink Spam Score ≤", 0, 100, 10)
|
81 |
page_from_language = st.sidebar.selectbox("Page From Language", ['en', 'other'])
|
82 |
+
is_broken = st.sidebar.checkbox("Is Broken", value=False) # Added is_broken filter
|
83 |
|
84 |
# Prepare filters for API call
|
85 |
filters = []
|
|
|
97 |
filters.append(["dofollow", "=", dofollow])
|
98 |
filters.append("and")
|
99 |
|
100 |
+
if is_broken:
|
101 |
+
filters.append(["is_broken", "=", is_broken])
|
102 |
+
filters.append("and")
|
103 |
+
|
104 |
filters.append(["backlink_spam_score", "<=", backlink_spam_score])
|
105 |
filters.append("and")
|
106 |
filters.append(["page_from_language", "=", page_from_language])
|
|
|
123 |
|
124 |
# Generate CSV and download button
|
125 |
if generate_button and target_url:
|
126 |
+
df = get_backlinks(api_login, api_key, target_url, filters)
|
127 |
if df is not None:
|
128 |
csv = convert_df_to_csv(df)
|
129 |
st.download_button(
|