File size: 992 Bytes
75788a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""Simple test to see API response."""
import serpapi
from config import settings

client = serpapi.Client(api_key=settings.serpapi_api_key)
results = client.search({
    "engine": "google_shopping_light",
    "q": "mobile under 2000 INR",
    "gl": "in",
    "hl": "en",
    "max_price": 2000
})

shopping_results = results.get("shopping_results", [])
print(f"Found {len(shopping_results)} results")

if shopping_results:
    first = shopping_results[0]
    print("\nFirst product keys:")
    for key in first.keys():
        print(f"  - {key}")
    
    print("\nLink-related fields:")
    print(f"  product_link: {first.get('product_link', 'NOT FOUND')}")
    print(f"  link: {first.get('link', 'NOT FOUND')}")
    print(f"  tracking_link: {first.get('tracking_link', 'NOT FOUND')}")
    
    print("\nFirst product data:")
    print(f"  Title: {first.get('title', 'N/A')}")
    print(f"  Price: {first.get('extracted_price', 'N/A')}")
    print(f"  Source: {first.get('source', 'N/A')}")