Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python-使用Flipkart API的参数_Python_Selenium_Beautifulsoup - Fatal编程技术网

Python-使用Flipkart API的参数

Python-使用Flipkart API的参数,python,selenium,beautifulsoup,Python,Selenium,Beautifulsoup,我试图使用本文中给出的脚本获取评论信息。我能找到一页。有没有办法让它多页。代码如下: import requests data = {"productId": "MOBEG4XWJG7F9A6Z", # end of url pid=MOBEG4XWJG7F9A6Z "count": "15", "ratings": "ALL", "reviewerType:ALL" "sortOrder": "MOST_HELPFUL"} h

我试图使用本文中给出的脚本获取评论信息。我能找到一页。有没有办法让它多页。代码如下:

import requests

data = {"productId": "MOBEG4XWJG7F9A6Z", # end of url pid=MOBEG4XWJG7F9A6Z
        "count": "15",
        "ratings": "ALL",
        "reviewerType:ALL"
        "sortOrder": "MOST_HELPFUL"}

headers = ({"x-user-agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36 FKUA/website/41/website/Desktop"})
data = requests.get("https://www.flipkart.com/api/3/product/reviews", params=data, headers=headers).json()
我尝试按如下方式更改参数:

data = {"productId": "MOBEG4XWJG7F9A6Z", # end of url pid=MOBEG4XWJG7F9A6Z
        "count": "15",
        "ratings": "ALL",
        "reviewerType:ALL"
        "sortOrder": "MOST_HELPFUL",
        "page": "2"}
但我得到了和以前一样的评价。我尝试使用以下命令获取URL路径:

data.request.path_url

当我尝试在浏览器中粘贴获得的URL时,返回了一个错误是否有办法找到用于迭代页码的参数。请提供帮助。我是Python新手

控制当前页面的是
start
参数:

data = {"productId": "MOBEG4XWJG7F9A6Z", # end of url pid=MOBEG4XWJG7F9A6Z
        "count": "15",
        "ratings": "ALL",
        "reviewerType": "ALL"
        "sortOrder": "MOST_HELPFUL",
        "start": "15"}  # page number 2

工作得很好。。谢谢。我有一个小疑问,您是如何确定参数是
start
?你能让我知道吗,这样我也能理解。再次感谢。@Jeril它基本上是从开始的偏移量,可以概括为“计数*页码”,其中
page\u number
从0开始。换句话说,对于
count=15
,您的第一页将有start=0、second:start=15、second:start=30等。希望这对您有所帮助。