I have an issue the following code in my Spider-Class:
def parse(self, response):
item = ResponseItem();
item['url'] = response.headers["Location"]
item['status'] = response.status
filename = response.url.split("/")[-2] + '.txt'
with open (filename, 'wb') as f:
f.write("%r" %response.status)
f.write("\r\n")
f.write("%s" %item['url'])
return scrapy.Request("http://www.google.com/", callback=self.testparse)
def testparse(self, response): ...
Scrapy/Python doesn't do the Request defined in the parse-Method. I'm quite new to Scrapy and Python, so can anyone tell me, what I've made wrong?
(The request-URL is just an example)
Sorry for my late response, but I have found my solution. Idiotically I forgot to set the right allowed domains...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.