Perform automated and live-interactive testing on 3000+ real desktop and mobile devices online.
Here are steps to follow to get Google search results in Python:
!pip instal google-api-python-client
Now all you have to do is execute the following code:
from googleapiclient.discovery import build
my_api_key = "your API KEY TYPE HERE"
my_cse_id = "YOUR CUSTOM SEARCH ENGINE ID TYPE HERE"
def google_search(search_term, api_key, cse_id, **kwargs):
service = build("customsearch", "v1", developerKey=api_key)
res = service.cse().list(q=search_term, cx=cse_id, **kwargs).execute()
return res['items']
results= google_search("YOUR SEARCH QUERY HERE",my_api_key,my_cse_id,num=10)
for result in results:
print(result["link"])
Test your websites, web-apps, or mobile apps seamlessly with LambdaTest.
Start Free TestingEarn resume-worthy Selenium certifications that help you land a top job.
Learn MoreTest orchestration and execution cloud of 3000+ browsers and OS
24/7 support
Enterprise grade security
Fastest test execution cloud