Reputation: 1007
Is there any way that I can get the response.body
from the Request function in scrapy?
I have this:
request = Request("http://www.example.com", callback = self.mytest)
def mytest(self, response)
return response.body
Now I want to get response.body
in a Python variable, How can I get that?
I want something like
myresponse = Request("http://www.example.com").get('response')
Upvotes: 6
Views: 5576
Reputation: 39
try using the scrapy inline requests: https://github.com/rmax/scrapy-inline-requests/
Upvotes: 0
Reputation: 8192
Is there a way to get the Response from a Request you just created? No, only the callback function has access to the Response. Once inside the callback you can access the Request via response.request, but not vise-versa.
Upvotes: 4