guide 4 min read

Google Shopping API in Python: Inspect Search Results

Use SERPpost V1 in Python to request Google Shopping results, inspect shopping_results, and keep Merchant catalog work separate.

SERPpost Team

SERPpost V1 can return Google Shopping search results when you send t: "google_shopping" to POST /api/v1/search. In Python, check the response code first and read data.shopping_results only when it is present. This workflow reads search-result listings. It does not manage a Merchant Center product catalog.

That distinction matters. A search-result request starts with a query such as wireless headphones; it helps an application inspect the listings returned for that search. It is a different job from maintaining a business’s own product information on Google.

Decide whether you need search results or Merchant catalog management

Use this workflow when your application needs to inspect Google Shopping results for a query. For example, a research tool may save the returned list alongside the query, country, language, and retrieval time so a teammate can review the response later.

Google’s Merchant API documentation describes an API for managing how a business and its products appear on Google. That is useful for a merchant’s catalog workflow. It is not the same as asking for the Google Shopping results returned for a search query.

Send one documented V1 request

Keep the API key in a server-side environment. The request below asks for a Google Shopping result set in the United States. Replace the query with the commercial search you need to inspect.


import os

import requests


api_key = os.environ["SERPPOST_API_KEY"]
payload = {
    "s": "wireless headphones",
    "t": "google_shopping",
    "p": 1,
    "d": 20000,
    "country": "us",
    "language": "en",
    "maxCache": 0,
}

response = requests.post(
    "https://serppost.com/api/v1/search",
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    json=payload,
    timeout=30,
)
response.raise_for_status()

body = response.json()
if body.get("code") != 0:
    raise RuntimeError(body.get("msg", "SERPpost request failed"))

shopping_results = body.get("data", {}).get("shopping_results")

The Playground uses maxCache: 0 so you can inspect a live request. Keep that choice deliberate in production: choose cache, storage, and retry behavior for your own workload rather than assuming a sample request is a production policy.

Inspect the returned list before choosing fields

Do not build a data model around field names you have not observed for the query you sent. Search-result fields can vary by query, so first confirm that the response contains a list and inspect the objects your application received.


if shopping_results is None:
    print("No Google Shopping result list was returned for this query.")
elif not isinstance(shopping_results, list):
    raise TypeError("shopping_results was not a list")
else:
    for listing in shopping_results:
        if isinstance(listing, dict):
            print(listing)

This small check is more useful than guessing at a universal product schema. If your next step is a CSV, database record, or alert, select only the fields that are present in the responses you have validated and keep the original JSON nearby for troubleshooting.

Keep the search context with the result data

The returned list is easier to interpret when you store the request context with it. At minimum, keep these values together:

  1. The query you sent.
  2. The country and language values.
  3. The retrieval time.
  4. The raw response before your application selects fields.

That record lets a teammate tell whether two result lists came from the same search context. It also makes it clear that a missing list is a response condition to inspect, not a reason to silently write an empty downstream record.

Use the right SERPpost route for the next task

Google Shopping result data comes from /api/v1/search. If you already have a public URL and need readable page or file content, that is a separate Reader request to /api/v1/url. The V1 documentation lists the available result types and response fields to inspect.

You can test the request shape in the API Playground before putting a key into a backend job. When you are ready to use your own key, create a free account.

FAQ

Is this the Google Merchant API?

No. This workflow sends a search query to SERPpost V1 and reads the returned Google Shopping result list. Merchant API catalog management is a separate Google integration for a business’s own product data.

Which product fields will I receive?

Inspect the response for the query you sent before depending on individual fields. This guide deliberately reads shopping_results without promising a fixed item schema.

Can I use a country other than the United States?

Yes. Set country and language to the search context you need, then keep those values with the result data.

Does this request capture the content behind a result URL?

No. This request returns search-result data. Use the Reader route after you already have a public URL and need page or file content.

Share:
SERPpost Team

SERPpost Team

Technical Content Team

The SERPpost technical team writes practical tutorials, implementation guides, and buyer-side notes about V1 search result types, source capture, and API workflow integration.

Try SERPpost V1 with a real request

Create a free account to validate a V1 request, then choose a paid pack when you need more credits or Request Slots.