Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/329.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 刮屑表单请求不存在';不要返回任何数据_Python_Web Scraping_Scrapy_Http Post - Fatal编程技术网

Python 刮屑表单请求不存在';不要返回任何数据

Python 刮屑表单请求不存在';不要返回任何数据,python,web-scraping,scrapy,http-post,Python,Web Scraping,Scrapy,Http Post,我在向一个网站申请表格。请求已成功发出,但未返回任何数据 日志: 下面是我在POST请求中使用的一些示例代码 2146709 273286 120670 2036998 690147我相信您所需要的只是从XPath中删除tbody,如下所示: cargo = response.xpath('(//table[@summary="Cargo Carried"]/tbody/tr)[2]') 这样使用: cargo = response.xpath('//tab

我在向一个网站申请表格。请求已成功发出,但未返回任何数据

日志: 下面是我在POST请求中使用的一些示例代码

2146709

273286

120670

2036998


690147

我相信您所需要的只是从XPath中删除
tbody
,如下所示:

    cargo = response.xpath('(//table[@summary="Cargo Carried"]/tbody/tr)[2]')
这样使用:

    cargo = response.xpath('//table[@summary="Cargo Carried"]/tr[2]') 
    # I also removed the () inside the path because you don't need it, but that didn't cause the problem.
原因是Scrapy将解析页面中的原始代码,而浏览器可能会呈现
tbody
,以防它不在源代码中。进一步资料

    cargo = response.xpath('(//table[@summary="Cargo Carried"]/tbody/tr)[2]')
    cargo = response.xpath('//table[@summary="Cargo Carried"]/tr[2]') 
    # I also removed the () inside the path because you don't need it, but that didn't cause the problem.