我有这个有效的 python 请求代码,但我不明白参数代表什么。我想了解如何为 python 请求设置参数,以及是否有很好的参考。这是我使用的代码
url = 'https://www.walmart.com/store/1003-York-pa/search?query=ice%20cream'
api_url = 'https://www.walmart.com/store/electrode/api/search'
params = {
'query': word,
'cat_id': 0,
'ps': 24,
'offset': 0,
'prg': 'desktop',
'stores': re.search(r'store/(\d+)', url).group(1)
}
data1 = requests.get(api_url, params=params).json()
我了解大部分代码,但并不真正了解 param 的这些属性
'cat_id': 0,
'ps': 24,
'offset': 0,
谁能解释一下为此提供解释以及如何为python请求设置参数