Scrapy XmlFeedSpider based on String Argument - How to Suppress Automatic Request
<p><strong>Aim:</strong> Trigger the execution of an XMLFeedSpider by passing the response as an argument (i.e. no need for start_urls). </p>

<p>Example Command:</p>

<pre><code>scrapy crawl spider_name -a response_as_string="&lt;xml&gt;&lt;sometag&gt;abc123&lt;/sometag&gt;&lt;/xml&gt;"
</code></pre>

<p>Example Spider:</p>

<pre><code>class ExampleXmlSpider(XMLFeedSpider):

    name = "spider_name"
    itertag = 'sometag'

    def parse_node(self, response, node):
        response2 = XmlResponse(url="Some URL", body=self.response_as_string)
        ProcessResponse().get_data(response2)

    def __init__(self, response_as_string=''):
        self.response_as_string = response_as_string
</code></pre>

<p><strong>Problem:</strong> Terminal complains that there is no start_urls. I can only get the above to work if I include a dummy.xml within start_urls.</p>

<p>E.g.</p>

<pre><code>start_urls = ['file:///home/user/dummy.xml']
</code></pre>

<p><strong>Question:</strong> Is there anyway to have an XMLFeedSpider that is purely driven by a response provided by an argument (as per the original command)? In which case I would need to suppress the need for the XMLFeedSpider to seek out a start_url to execute a request.</p>