Sorry is it this sel = Selector(xml_response)
Only issue is that it returns xml_response error.
File
"/home/sayth/.virtualenvs/scrapy_xml/local/lib/python2.7/site-packages/twisted/internet/defer.py",
line 588, in _runCallbacks
current.result = callback(current.result, *args, **kw)
File "/home/sayth/Projects/conv_xml/conv_xml/spiders/myxml.py", line 14,
in parse
sel = Selector(xml_response)
NameError: global name 'xml_response' is not defined
On Sunday, 24 January 2016 14:35:42 UTC+11, Sayth Renshaw wrote:
>
> Hi
>
> Just putting together my first xml parser in scrapy and while it works i
> noted a deprecation in the logs and wanted to know what I should be doing
> moving forward. Below is my code this is the warning.
>
>
> 2016-01-24 14:32:04 [py.warnings] WARNING:
> /home/sayth/.virtualenvs/scrapy_xml/local/lib/python2.7/site-packages/scrapy/selector/unified.py:108:
>
> ScrapyDeprecationWarning: scrapy.selector.XmlXPathSelector is deprecated,
> instantiate scrapy.Selector instead.
> for x in result]
>
> # -*- coding: utf-8 -*-
> import scrapy
> from scrapy.selector import Selector
> from scrapy.http import HtmlResponse
> from scrapy.selector import XmlXPathSelector
>
> class MyxmlSpider(scrapy.Spider):
> name = "myxml"
>
> start_urls = (
> ["file:///home/sayth/Downloads/20160123RAND0.xml"]
> )
>
> def parse(self, response):
> xpath = XmlXPathSelector(response)
> for ids in xpath.select('.//race/@id'):
> print(ids.extract())
>
> Thanks
>
>
> Sayth
>
>
--
You received this message because you are subscribed to the Google Groups
"scrapy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/scrapy-users.
For more options, visit https://groups.google.com/d/optout.