SerpResults

A dictionary-like object that represents the results of a SerpApi request.

Usage

Source

SerpResults()

An instance of this class is returned if the response is a valid JSON object. It can be used like a dictionary, but also has some additional methods.

Attributes

Name Description
next_page_url The URL of the next page of results, if any.

next_page_url

The URL of the next page of results, if any.

next_page_url

Methods

Name Description
__repr__() The visual representation of the data, which is pretty printed, for
as_dict() Returns the data as a standard Python dictionary.
from_http_response() Construct a SerpResults object from an HTTP response.
next_page() Return the next page of results, if any.
yield_pages() A generator that yield s the next n pages of search results, if any.

__repr__()

The visual representation of the data, which is pretty printed, for

Usage

Source

__repr__()

ease of use.


as_dict()

Returns the data as a standard Python dictionary.

Usage

Source

as_dict()

This can be useful when passing results to libraries that expect a plain dict.


from_http_response()

Construct a SerpResults object from an HTTP response.

Usage

Source

from_http_response(r, *, client=None)
Parameters
r

The HTTP response to parse.

client=None
the Client instance which was used to send this request. An instance of this class is returned if the response is a valid JSON object. Otherwise, the raw text (as a properly decoded unicode string) is returned.

next_page()

Return the next page of results, if any.

Usage

Source

next_page()

yield_pages()

A generator that yield s the next n pages of search results, if any.

Usage

Source

yield_pages(max_pages=1000)
Parameters
max_pages=1000
limit the number of pages yielded to n.