我正在尝试使用 scrapy 为 m-ati.su 编写解析器。第一步,我必须从组合框中获取不同城市名称为“From”和“To”的值和文本字段。我看着萤火虫的请求并写道
class spider(BaseSpider):
name = 'ati_su'
start_urls = ['http://m-ati.su/Tables/Default.aspx?EntityType=Load']
allowed_domains = ["m-ati.su"]
def parse(self, response):
yield FormRequest('http://m-ati.su/Services/ATIGeoService.asmx/GetGeoCompletionList',
callback=self.ati_from,
formdata={'prefixText': 'moscow', 'count': '10','contextKey':'All_0$Rus'})
def ati_from(self, response):
json = response.body
open('results.txt', 'wb').write(json)
对于这个请求,我有“500 内部服务器错误”。我做错了什么?抱歉英语不好。谢谢