antfraia commited on
Commit
92d23f8
·
1 Parent(s): c3cb9f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -16,7 +16,19 @@ def get_product_details(asin, domain):
16
  'context': [{'key': 'autoselect_variant', 'value': True}]
17
  }
18
  response = requests.post(OXYLABS_ENDPOINT, auth=OXYLABS_AUTH, json=payload)
19
- return json.dumps(response.json(), indent=4)
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  def get_reviews(asin, domain):
22
  payload = {
 
16
  'context': [{'key': 'autoselect_variant', 'value': True}]
17
  }
18
  response = requests.post(OXYLABS_ENDPOINT, auth=OXYLABS_AUTH, json=payload)
19
+ data = response.json()["results"][0]["content"]
20
+
21
+ # Isolate information referring to the input ASIN
22
+ product_info = {
23
+ "asin": data.get("asin", "N/A"),
24
+ "title": data.get("title", "N/A"),
25
+ "brand": data.get("brand", "N/A"),
26
+ "price": data.get("price", "N/A"),
27
+ "rating": data.get("rating", "N/A"),
28
+ "description": data.get("description", "N/A")
29
+ }
30
+
31
+ return json.dumps(product_info, indent=4)
32
 
33
  def get_reviews(asin, domain):
34
  payload = {