added comment to parse_searchrequest and added optional todo for extract()[0] usage
This commit is contained in:
parent
3c5dbc44dc
commit
63fb9f4733
@ -5,6 +5,9 @@ from scrapy.selector import Selector
|
|||||||
from FourmiCrawler.items import Result
|
from FourmiCrawler.items import Result
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
# TODO: Maybe clean up usage of '.extract()[0]', because it will raise an
|
||||||
|
# IndexError exception if the xpath matches nothing
|
||||||
|
|
||||||
class ChemSpider(Parser):
|
class ChemSpider(Parser):
|
||||||
"""ChemSpider scraper for synonyms and properties
|
"""ChemSpider scraper for synonyms and properties
|
||||||
|
|
||||||
@ -187,6 +190,7 @@ somewhere.
|
|||||||
return properties
|
return properties
|
||||||
|
|
||||||
def parse_searchrequest(self, response):
|
def parse_searchrequest(self, response):
|
||||||
|
"""Parse the initial response of the ChemSpider Search API """
|
||||||
sel = Selector(response)
|
sel = Selector(response)
|
||||||
log.msg('chemspider parse_searchrequest', level=log.DEBUG)
|
log.msg('chemspider parse_searchrequest', level=log.DEBUG)
|
||||||
sel.register_namespace('cs', 'http://www.chemspider.com/')
|
sel.register_namespace('cs', 'http://www.chemspider.com/')
|
||||||
|
Reference in New Issue
Block a user