File size: 758 Bytes
ad91a7c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import streamlit as st
from googleapiclient.discovery import build
# ...  (rest of the setup code as before)

st.title("Search Analytics Viewer")

# User Inputs
site_url = st.text_input("Enter your website URL:", "https://www.example.com")
start_date = st.date_input("Start Date")
end_date = st.date_input("End Date")
credentials_file = st.file_uploader("Upload your JSON credentials file")

if st.button("Fetch Data"):
    if credentials_file: 
        # ... (Authentication setup using uploaded credentials)

        # ... (Build the API request using user inputs)

        response = service.searchanalytics().query(siteUrl=request['siteUrl'], body=request).execute()

        # ... (Handle and display the API response in a data table or visualization)