grapplerulrich's picture
Initial commit of working google search with URL return
0fbacc4
raw
history blame
550 Bytes
import streamlit as st
from dotenv import load_dotenv
from googleapiclient.discovery import build
import os
def main():
load_dotenv()
st.title('Google Search')
query = st.text_input('Search query')
api_key = os.getenv('GOOGLE_SEARCH_API_KEY')
service = build(
"customsearch",
"v1",
developerKey=api_key
)
if ( query ):
results = service.cse().list(
q=query,
cx='05048cc2df6134a06',
).execute()
for item in results['items']:
st.write(item['link'])
if __name__ == '__main__':
main()