Skip to content

Instantly share code, notes, and snippets.

@thetafferboy
thetafferboy / cse.py
Created October 18, 2023 11:17
Connect to Google CSE and get title and URL of top 10 results
import requests
def get_top_10_search_results(query, api_key, cx):
endpoint = "https://www.googleapis.com/customsearch/v1"
params = {
'q': query,
'key': api_key,
'cx': cx,
'num': 10
}