Client

A class that handles API requests to SerpApi in a user-friendly manner.

Usage

Source

Client()

Store your API key in an environment variable, then create a client with serpapi.Client(api_key=os.environ["SERPAPI_KEY"]).

Parameters

api_key=None

The API Key to use for SerpApi.com.

timeout=None
The default timeout to use for requests.

Attributes

Name Description
DASHBOARD_URL str(object=’’) -> str

DASHBOARD_URL

str(object=’’) -> str

DASHBOARD_URL="https://serpapi.com/dashboard"

str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to ‘utf-8’. errors defaults to ‘strict’.

Methods

Name Description
account() Get SerpApi account information.
locations() Get a list of supported Google locations.
search() Fetch a page of results from SerpApi.
search_archive() Get a result from the SerpApi Search Archive API.

account()

Get SerpApi account information.

Usage

Source

account(params=None, **kwargs)
Parameters
params: dict = None

Account API parameters.

kwargs={}
Additional account parameters or request options. timeout, proxies, verify, stream, and cert are passed to the underlying HTTP request. Learn more: https://serpapi.com/account-api

locations()

Get a list of supported Google locations.

Usage

Source

locations(params=None, **kwargs)
Parameters
params: dict = None

Location API parameters such as q and limit.

kwargs={}
Additional location parameters or request options. timeout, proxies, verify, stream, and cert are passed to the underlying HTTP request. Learn more: https://serpapi.com/locations-api


search_archive()

Get a result from the SerpApi Search Archive API.

Usage

Source

search_archive(params=None, **kwargs)
Parameters
params: dict = None

Archive parameters. Must include search_id.

kwargs={}
Additional archive parameters or request options. timeout, proxies, verify, stream, and cert are passed to the underlying HTTP request. Learn more: https://serpapi.com/search-archive-api