GoogleTrendsAPIWrapper#

class langchain_community.utilities.google_trends.GoogleTrendsAPIWrapper[source]#

Bases: BaseModel

Wrapper for SerpApi’s Google Scholar API

You can create SerpApi.com key by signing up at: https://serpapi.com/users/sign_up.

The wrapper uses the SerpApi.com python package: https://serpapi.com/integrations/python

To use, you should have the environment variable SERPAPI_API_KEY set with your API key, or pass serp_api_key as a named parameter to the constructor.

Example:

from langchain_community.utilities import GoogleTrendsAPIWrapper google_trends = GoogleTrendsAPIWrapper() google_trends.run(‘langchain’)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

param serp_api_key: SecretStr | None = None#
Constraints:
  • type = string

  • writeOnly = True

  • format = password

param serp_search_engine: Any = None#
run(query: str) str[source]#

Run query through Google Trends with Serpapi

Parameters:

query (str) –

Return type:

str

Examples using GoogleTrendsAPIWrapper