This repository is the home of the soon–to–be official Python API wrapper for SerpApi (https://serpapi.com). This serpapi
module allows you to access search data in your Python application.
SerpApi supports Google, Google Maps, Google Shopping, Bing, Baidu, Yandex, Yahoo, eBay, App Stores, and more. Check out the documentation for a full list.
This project is under development, and will be released to the public on PyPi soon.
To install the serpapi
package, simply run the following command:
$ pip install serpapi
Please note that this package is separate from the soon–to–be legacy serpapi
module, which is currently available on PyPi as google-search-results
.
Let’s start by searching for Coffee on Google:
>>> import serpapi
>>> s = serpapi.search(q="Coffee", engine="google", location="Austin, Texas", hl="en", gl="us")
The s
variable now contains a SerpResults
object, which acts just like a standard dictionary, with some convenient functions added on top.
Let’s print the first result:
>>> s["organic_results"][0]["link"]
'https://en.wikipedia.org/wiki/Coffee'
Let’s print the title of the first result, but in a more Pythonic way:
>>> s["organic_results"][0].get("title")
'Coffee - Wikipedia'
The SerpApi.com API Documentation contains a list of all the possible parameters that can be passed to the API.
Documentation is available on Read the Docs.
MIT License.
Bug reports and pull requests are welcome on GitHub. Once dependencies are installed, you can run the tests with pytest
.