Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from googleapiclient.discovery import build
|
3 |
+
# ... (rest of the setup code as before)
|
4 |
+
|
5 |
+
st.title("Search Analytics Viewer")
|
6 |
+
|
7 |
+
# User Inputs
|
8 |
+
site_url = st.text_input("Enter your website URL:", "https://www.example.com")
|
9 |
+
start_date = st.date_input("Start Date")
|
10 |
+
end_date = st.date_input("End Date")
|
11 |
+
credentials_file = st.file_uploader("Upload your JSON credentials file")
|
12 |
+
|
13 |
+
if st.button("Fetch Data"):
|
14 |
+
if credentials_file:
|
15 |
+
# ... (Authentication setup using uploaded credentials)
|
16 |
+
|
17 |
+
# ... (Build the API request using user inputs)
|
18 |
+
|
19 |
+
response = service.searchanalytics().query(siteUrl=request['siteUrl'], body=request).execute()
|
20 |
+
|
21 |
+
# ... (Handle and display the API response in a data table or visualization)
|
22 |
+
|