1

フォームに投稿するだけのはずの次のスパイダーがあります。私はそれを機能させることができないようです。Scrapy で実行すると、応答が表示されません。誰かが私がこれでどこが間違っているのか教えてもらえますか?

これが私のスパイダーコードです:

# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import scrapy
from scrapy.http import FormRequest
from scrapy.shell import inspect_response


class RajasthanSpider(scrapy.Spider):
    name = "rajasthan"
    allowed_domains = ["rajtax.gov.in"]
    start_urls = (
        'http://www.rajtax.gov.in/',
    )

    def parse(self, response):
        return FormRequest.from_response(
            response,
            formname='rightMenuForm',
            formdata={'dispatch': 'dealerSearch'},
            callback=self.dealer_search_page)

    def dealer_search_page(self, response):

        yield FormRequest.from_response(
            response,
            formname='dealerSearchForm',
            formdata={
                "zone": "select",
                "dealertype": "VAT",
                "dealerSearchBy": "dealername",
                "name": "ana"
            }, callback=self.process)

    def process(self, response):
        inspect_response(response, self)

私が得るのは、次のような応答です。 結果が見つかりません

私が得るべきものは、次のような結果です: 見つかった結果

mydealer_search_page()を Splash に置き換えると、次のようになります。

def dealer_search_page(self, response):

    yield FormRequest.from_response(
        response,
        formname='dealerSearchForm',
        formdata={
            "zone": "select",
            "dealertype": "VAT",
            "dealerSearchBy": "dealername",
            "name": "ana"
        },
        callback=self.process,
        meta={
            'splash': {
                'endpoint': 'render.html',
                'args': {'wait': 0.5}
            }
        })

次の警告が表示されます。

2016-03-14 15:01:29 [scrapy] WARNING: Currently only GET requests are supported by SplashMiddleware; <POST http://rajtax.gov.in:80/vatweb/dealerSearch.do> will be handled without Splash

inspect_response()そして、プログラムは my in my process()functionに到達する前に終了します。

エラーは、スプラッシュがまだサポートされていないことを示しPOSTています。Splashこのユースケースで機能しますか、それとも使用する必要がありますSeleniumか?

4

2 に答える 2