Spaces:
Sleeping
Sleeping
Update google_function.py
Browse files131 unmodified lines132133134135136137138131 unmodified linesreturn descrizione_eventi, links#---------------------------------------------------------- CONNESSIONE ACCOUNT GOOGLE ---------------------------------------------------------def connetti_google():load_dotenv()json_variable_str = os.getenv("JSON_GOOGLE")print(json_variable_str)131 unmodified lines132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170131 unmodified linesreturn descrizione_eventi, links#---------------------------------------------------------- CONNESSIONE ACCOUNT GOOGLE ---------------------------------------------------------def connetti_google():load_dotenv()json_variable_str = os.getenv("JSON_GOOGLE")print(json_variable_str)with open("./credentials.json", "w") as f:f.write(json_variable_str)if os.path.exists("./credentials.json"):print('ESISTE')else:print('NON ESISTE')creds = Nonest.write("Welcome to My App!")auth_code = st.query_params.get("code")flow = google_auth_oauthlib.flow.Flow.from_client_secrets_file("./credentials.json", SCOPES, redirect_uri='https://matteoscript-streamlitchat-new.hf.space')if auth_code:flow.fetch_token(code=auth_code)credentials = flow.credentialsst.write("Login Done")user_info_service = build(serviceName="oauth2",version="v2",credentials=credentials,)user_info = user_info_service.userinfo().get().execute()assert user_info.get("email"), "Email not found in infos"st.session_state["google_auth_code"] = auth_codest.session_state["user_info"] = user_infoelse:authorization_url, state = flow.authorization_url(include_granted_scopes="true",)print(authorization_url)webbrowser.open_new_tab(authorization_url)def connetti_google_2():load_dotenv()json_variable_str = os.getenv("JSON_GOOGLE")print(json_variable_str)
google_function.py+33-1