joshuadunlop commited on
Commit
6ef1dcb
·
verified ·
1 Parent(s): 355da1e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -44,8 +44,13 @@ reset_button = st.sidebar.button("Reset")
44
 
45
  # Make sure to pass api_login to the get_backlinks function
46
  if generate_button and target_url:
47
- data = get_backlinks(api_login, api_key, target_url, filters)
48
- # [Your existing code to handle the data and provide a download link for the CSV]
 
 
 
 
 
49
 
50
  # Filters
51
  url_from_not_contain = st.sidebar.text_input("URL from does not contain (comma-separated)")
 
44
 
45
  # Make sure to pass api_login to the get_backlinks function
46
  if generate_button and target_url:
47
+ data = get_backlinks(api_key, target_url, filters)
48
+ if data:
49
+ df = pd.DataFrame(data)
50
+ csv = df.to_csv(index=False)
51
+ b64 = base64.b64encode(csv.encode()).decode()
52
+ href = f'<a href="data:file/csv;base64,{b64}" download="backlinks.csv">Download CSV file</a>'
53
+ st.markdown(href, unsafe_allow_html=True)
54
 
55
  # Filters
56
  url_from_not_contain = st.sidebar.text_input("URL from does not contain (comma-separated)")