1
I’m starting to learn scrapy and created the following function:
import scrapy
class ModelSpider(scrapy.Spider):
name = "model"
start_urls = [
'http://www.icarros.com/'
]
def parse(self, response):
with open('brands.csv', 'r') as all_brands:
for brand in all_brands:
brand = brand.replace("\n", "")
url = 'http://www.icarros.com/'+brand
yield scrapy.Request(url, self.success_connect)
def success_connect(self, response):
self.log('Entrei')
But the following error appears:
AttributeError: 'ModelSpider' object has no attribute 'success_connect'
Can you post the context of the code? It should be in a class
– rodorgas
is in a Spider. @swirls
– Lucas Lopes