One way to try out SerpApi or to create an easily shareable demo project is to use Google Colab.

Google Colab is a free cloud service that provides a Python development environment. It enables us to write and execute Python code through our browsers without any setup.

Using Google Colab in SerpApi

Step By Step

  1. Setup account
    Login to your Google account and open the Google Colab website.
  2. Setup a new notebook
    Create a new notebook
how to create a new notebook at Google Colab
  1. Setup SerpApi account
    Register at serpapi.com and grab your API Key from the dashboard.
  2. Setup API Key
    Paste your SerpAPI API Key on the "secrets tab" to ensure your API Key stays safe.
Save secret env file on Google Colab

You can name it whatever you want, for example SERPAPI_API_KEY and paste your real API key into the value section. Don't forget to toggle the button to allow the notebook to access this key.

5. Access the API Key
To access the API Key programmatically, use the userdata method from Google Colab.

Now we have the SERPAPI_API_KEY variable that we can use everywhere.

Don't forget to click the "play" button on the left side of the code block, to run each code block.
  1. Install SerpApi Python package
    Run !pip install google-search-results on the code section
  2. Basic sample
    Now, let's try the basic Google Search API
from serpapi import GoogleSearch

params = {
  "q": "Tea and Coffee",
  "location": "Austin, Texas, United States",
  "hl": "en",
  "gl": "us",
  "google_domain": "google.com",
  "api_key": SERPAPI_API_KEY
}

search = GoogleSearch(params)
results = search.get_dict()
print(results)

Try to run this code and see the result!

Share your Google Colab project

If you're creating a prototype or a demo project to share with your teammates, you can click the "share" button on the top right corner. You can choose either to allow specific users or make it public. Now anyone can check out your SerpApi project!