{"id":15288448,"url":"https://github.com/serpapi/serpapi-python","last_synced_at":"2026-04-01T17:29:19.238Z","repository":{"id":36970609,"uuid":"472165377","full_name":"serpapi/serpapi-python","owner":"serpapi","description":"Official Python wrapper for SerpApi HTTP endpoints","archived":false,"fork":false,"pushed_at":"2026-03-12T14:32:08.000Z","size":544,"stargazers_count":125,"open_issues_count":3,"forks_count":11,"subscribers_count":15,"default_branch":"master","last_synced_at":"2026-03-12T20:40:46.591Z","etag":null,"topics":["api","api-client","api-wrapper","google-search-api","google-search-results","python","requests","scraping-api","serpapi"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/serpapi/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serpapi.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-03-21T02:49:36.000Z","updated_at":"2026-03-12T14:32:30.000Z","dependencies_parsed_at":"2024-07-16T10:21:01.852Z","dependency_job_id":null,"html_url":"https://github.com/serpapi/serpapi-python","commit_stats":{"total_commits":149,"total_committers":6,"mean_commits":"24.833333333333332","dds":"0.24832214765100669","last_synced_commit":"cdcfb0ee8f7421f2fd5591519eac80cd64425751"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/serpapi/serpapi-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serpapi%2Fserpapi-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serpapi%2Fserpapi-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serpapi%2Fserpapi-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serpapi%2Fserpapi-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serpapi","download_url":"https://codeload.github.com/serpapi/serpapi-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serpapi%2Fserpapi-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31290537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-client","api-wrapper","google-search-api","google-search-results","python","requests","scraping-api","serpapi"],"created_at":"2024-09-30T15:49:12.815Z","updated_at":"2026-04-01T17:29:19.227Z","avatar_url":"https://github.com/serpapi.png","language":"Python","readme":"# SerpApi Python Library \u0026 Package\n[![Package](https://img.shields.io/pypi/v/serpapi?color=green)](https://pypi.org/project/serpapi) [![serpapi-python](https://github.com/serpapi/serpapi-python/actions/workflows/ci.yml/badge.svg)](https://github.com/serpapi/serpapi-python/actions/workflows/ci.yml)\n\nIntegrate search data into your AI workflow, RAG / fine-tuning, or Python application using this official wrapper for [SerpApi](https://serpapi.com). \n\nSerpApi supports Google, Google Maps, Google Shopping, Baidu, Yandex, Yahoo, eBay, App Stores, and [more](https://serpapi.com). \n\nQuery a vast range of data at scale, including web search results, flight schedules, stock market data, news headlines, and [more](https://serpapi.com).\n\n## Installation\n\nTo install the `serpapi` package, simply run the following command:\n\n```bash\n$ pip install serpapi\n```\n\nPlease note that this package is separate from the legacy `serpapi` module, which is available on PyPi as `google-search-results`. This package is maintained by SerpApi, and is the recommended way to access the SerpApi service from Python.\n\n## Simple Usage\n\nLet's start by searching for Coffee on Google:\n\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"SERPAPI_KEY\"))\nresults = client.search({\n  \"engine\": \"google\",\n  \"q\": \"coffee\"\n})\n\nprint(results)\n```\n\nThe `results` variable now contains a `SerpResults` object, which acts just like a standard dictionary, with some convenient functions added on top.\n\nThis example runs a search for \"coffee\" on Google. It then returns the results as a regular Python Hash.\n See the [playground](https://serpapi.com/playground) to generate your own code.\n\nThe SerpApi key can be obtained from [serpapi.com/signup](https://serpapi.com/users/sign_up?plan=free).\n\nEnvironment variables are a secure, safe, and easy way to manage secrets.\n Set `export SERPAPI_KEY=\u003csecret_serpapi_key\u003e` in your shell.\n Python accesses these variables from `os.environ[\"SERPAPI_KEY\"]`.\n\n### Error handling\n\nUnsuccessful requests raise `serpapi.HTTPError` or `serpapi.TimeoutError` exceptions. The returned status code will reflect the sort of error that occurred, please refer to [Status and Error Codes Documentation](https://serpapi.com/api-status-and-error-codes) for more details.\n\n```python\nimport os\nimport serpapi\n\n# A default timeout can be set here.\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"), timeout=10)\n\ntry:\n    results = client.search({\n        'engine': 'google',\n        'q': 'coffee',\n    })\nexcept serpapi.HTTPError as e:\n    if e.status_code == 401: # Invalid API key\n        print(e.error) # \"Invalid API key. Your API key should be here: https://serpapi.com/manage-api-key\"\n    elif e.status_code == 400: # Missing required parameter\n        pass\n    elif e.status_code == 429: # Exceeds the hourly throughput limit OR account run out of searches\n        pass\nexcept serpapi.TimeoutError as e:\n    # Handle timeout\n    print(f\"The request timed out: {e}\")\n```\n\n## Documentation\n\nDocumentation is [available on Read the Docs](https://serpapi-python.readthedocs.io/en/latest/).\n\nChange history is [available on GitHub](https://github.com/serpapi/serpapi-python/blob/master/HISTORY.md).\n\n## Basic Examples in Python\n\n### Search Bing\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'bing',\n    'q': 'coffee'\n})\n```\n- API Documentation: [serpapi.com/bing-search-api](https://serpapi.com/bing-search-api)\n\n### Search Baidu\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'baidu',\n    'q': 'coffee',\n})\n```\n- API Documentation: [serpapi.com/baidu-search-api](https://serpapi.com/baidu-search-api)\n\n### Search Yahoo\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'yahoo',\n    'p': 'coffee',\n})\n```\n- API Documentation: [serpapi.com/yahoo-search-api](https://serpapi.com/yahoo-search-api)\n\n### Search YouTube\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'youtube',\n    'search_query': 'coffee',\n})\n```\n- API Documentation: [serpapi.com/youtube-search-api](https://serpapi.com/youtube-search-api)\n\n### Search Walmart\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'walmart',\n    'query': 'coffee',\n})\n```\n- API Documentation: [serpapi.com/walmart-search-api](https://serpapi.com/walmart-search-api)\n\n### Search eBay\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'ebay',\n    '_nkw': 'coffee',\n})\n```\n- API Documentation: [serpapi.com/ebay-search-api](https://serpapi.com/ebay-search-api)\n\n### Search Naver\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'naver',\n    'query': 'coffee',\n})\n```\n- API Documentation: [serpapi.com/naver-search-api](https://serpapi.com/naver-search-api)\n\n### Search Home Depot\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'home_depot',\n    'q': 'table',\n})\n```\n- API Documentation: [serpapi.com/home-depot-search-api](https://serpapi.com/home-depot-search-api)\n\n### Search Apple App Store\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'apple_app_store',\n    'term': 'coffee',\n})\n```\n- API Documentation: [serpapi.com/apple-app-store](https://serpapi.com/apple-app-store)\n\n### Search DuckDuckGo\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'duckduckgo',\n    'q': 'coffee',\n})\n```\n- API Documentation: [serpapi.com/duckduckgo-search-api](https://serpapi.com/duckduckgo-search-api)\n\n### Search Google\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'google',\n    'q': 'coffee'\n})\n```\n- API Documentation: [serpapi.com/search-api](https://serpapi.com/search-api)\n\n### Search Google Scholar\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'google_scholar',\n    'q': 'coffee',\n})\n```\n- API Documentation: [serpapi.com/google-scholar-api](https://serpapi.com/google-scholar-api)\n\n### Search Google Autocomplete\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'google_autocomplete',\n    'q': 'coffee',\n})\n```\n- API Documentation: [serpapi.com/google-autocomplete-api](https://serpapi.com/google-autocomplete-api)\n\n### Search Google Immersive Product\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'google_immersive_product',\n    'page_token': 'eyJlaSI6Im5ZVmxaOXVVTDY2X3A4NFBqTnZELUFjIiwicHJvZHVjdGlkIjoiIiwiY2F0YWxvZ2lkIjoiNTE1NDU2NTc1NTc5MzcxMDY3NSIsImhlYWRsaW5lT2ZmZXJEb2NpZCI6IjI1MDkyMjcwMDUzMjk2NzQwODMiLCJpbWFnZURvY2lkIjoiMTYzOTg5MjU0MDcwMDU4MDA1NTQiLCJyZHMiOiJQQ18zNDg4MDE0MTg3ODgxNzc5NjU0fFBST0RfUENfMzQ4ODAxNDE4Nzg4MTc3OTY1NCIsInF1ZXJ5IjoibGcrdHYiLCJncGNpZCI6IjM0ODgwMTQxODc4ODE3Nzk2NTQiLCJtaWQiOiI1NzY0NjI3ODM3Nzc5MTUzMTMiLCJwdnQiOiJoZyIsInV1bGUiOm51bGx9=',\n})\n```\n- API Documentation: [serpapi.com/google-immersive-product-api](https://serpapi.com/google-immersive-product-api)\n\n### Search Google Reverse Image\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'google_reverse_image',\n    'image_url': 'https://i.imgur.com/5bGzZi7.jpg',\n    'max_results': '1',\n})\n```\n- API Documentation: [serpapi.com/google-reverse-image](https://serpapi.com/google-reverse-image)\n\n### Search Google Events\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'google_events',\n    'q': 'Events in Austin',\n})\n```\n- API Documentation: [serpapi.com/google-events-api](https://serpapi.com/google-events-api)\n\n### Search Google Local Services\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'google_local_services',\n    'q': 'electrician',\n    'data_cid': '6745062158417646970',\n})\n```\n- API Documentation: [serpapi.com/google-local-services-api](https://serpapi.com/google-local-services-api)\n\n### Search Google Maps\n```python\nimport os\nimport serpapi\n\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'google_maps',\n    'q': 'pizza',\n    'll': '@40.7455096,-74.0083012,15.1z',\n    'type': 'search',\n})\n```\n- API Documentation: [serpapi.com/google-maps-api](https://serpapi.com/google-maps-api)\n\n### Search Google Jobs\n```python\nimport os\nimport serpapi\n\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'google_jobs',\n    'q': 'coffee',\n})\n```\n- API Documentation: [serpapi.com/google-jobs-api](https://serpapi.com/google-jobs-api)\n\n### Search Google Play\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'google_play',\n    'q': 'kite',\n    'store': 'apps',\n})\n```\n- API Documentation: [serpapi.com/google-play-api](https://serpapi.com/google-play-api)\n\n### Search Google Images\n```python\nimport os\nimport serpapi\n\nclient = serpapi.Client(api_key=os.getenv(\"API_KEY\"))\nresults = client.search({\n    'engine': 'google_images',\n    'tbm': 'isch',\n    'q': 'coffee',\n})\n```\n- API Documentation: [serpapi.com/google-images-api](https://serpapi.com/google-images-api)\n\n## License\n\nMIT License.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub. Once dependencies are installed, you can run the tests with `pytest`.\n\n## Publishing a new release\n\n1. Update the version in `serpapi/__version__.py`.\n2. Push a tag — the release pipeline runs automatically:\n   ```sh\n   git tag v1.2.3\n   git push origin v1.2.3\n   ```\n   This triggers the [release workflow](.github/workflows/release.yml), which tests, builds, and publishes to PyPI, then smoke-tests the published package.\n\n\u003e **Required secrets:** `PYPI_API_TOKEN` (PyPI upload token) and `API_KEY` (used in smoke-test live search).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserpapi%2Fserpapi-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserpapi%2Fserpapi-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserpapi%2Fserpapi-python/lists"}