使用Scrapy发送此FormRequest后,web服务器返回“500内部服务器错误”
我根据httpFox(Firefox的一个插件)的内容构建了以下的表单请求。但是,网站服务器总是返回“500内部服务器错误”。
有人能帮我解决这个问题吗?
原始网址是: http://www.intel.com/jobs/jobsearch/index_ne.htm?Location=200000008
这是我爬虫的基本结构:
class IntelSpider(BaseSpider):
name = "intel.com"
allowed_domains = ["taleo.net"]
def start_requests(self):
req_china = FormRequest("https://intel.taleo.net/careersection/10020/moresearch.ajax",
formdata={
'iframemode': '1',
'ftlpageid': 'reqListAdvancedPage',
'ftlinterfaceid': 'advancedSearchFooterInterface',
'ftlcompid': 'SEARCH',
... # commentsThere are a lots of data here.#
'location1L2': '-1',
'dropListSize': '25',
'dropSortBy': '10'},
callback=self.test)
return [req_china]
def test(self, response):
print response.body
return
1 个回答
2
你的问题出在英特尔的网站,而不是在scrapy上。不过……表单通常会有一些隐藏的字段,发送POST请求的最好方法是这样的:
def start_requests(self,response):
req_china = FormRequest.from_response(response=response,
formdata={
'iframemode': '1',
'ftlpageid': 'reqListAdvancedPage',
'ftlinterfaceid': 'advancedSearchFooterInterface',
'ftlcompid': 'SEARCH',
... # commentsThere are a lots of data here.#
'location1L2': '-1',
'dropListSize': '25',
'dropSortBy': '10'},
callback=self.test)