我根据httpFox(Firefox addon)的内容构造了以下FormRequest。但是,Web 服务器总是返回“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
最佳答案
您的问题来自intel网页,而不是来自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)
关于python - 使用 Scrapy 发送此 FormRequest 后,Web 服务器返回 "500 Internal Server Error",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4008371/