1 回答
TA贡献1824条经验 获得超6个赞
你可以这样做:
import requests
import json
headers = headers = {'content-type': 'application/json'}
payload = {json.dumps({
"sort":null,
"per_page":12,
"scroll_id":null,
"session_id":null,
"q":"diapers",
"shingle_active":false,
"location":"110005",
"types":["allopathy","brand","sku","udp"],
"country":"",
"is_query_suggestion_applicable":false,
"debug":false,
"filters":null,
"facets":[{"field":"sku.brand.raw","name":"brand","type":"facet","range":null},{"field":"product_form","name":"product_form","type":"facet","range":null},{"field":"rx_required","name":"rx_required","type":"facet","range":null},{"field":"uses","name":"uses","type":"facet","range":null},{"field":"age","name":"age","type":"facet","range":null},{"field":"recommended","name":"recommended","type":"facet","range":null}],
"source_fields":["count"],
"query_filters":null,
"is_all":true
})}
url = 'https://search-stagapi.example.com/search-new/search/v1/search/lambda'
r = requests.post(url, params=payload, headers=headers)
添加回答
举报