should raise `AttributeError: Response.meta not available` when access response.meta in `process_resonse`?
See original GitHub issueshould raise AttributeError: Response.meta not available
when access response.meta in process_resonse
?
2018-12-03 23:12:47 [scrapy.core.scraper] ERROR: Error downloading <GET https://httpbin.org/status/200>
Traceback (most recent call last):
File "C:\Program Files\Python37\lib\site-packages\twisted\internet\defer.py", line 1418, in _inlineCallbacks
result = g.send(result)
File "C:\Program Files\Python37\lib\site-packages\scrapy\core\downloader\middleware.py", line 43, in process_request
defer.returnValue((yield download_func(request=request,spider=spider)))
File "C:\Program Files\Python37\lib\site-packages\twisted\internet\defer.py", line 1362, in returnValue
raise _DefGen_Return(val)
twisted.internet.defer._DefGen_Return: <200 https://httpbin.org/status/200>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python37\lib\site-packages\scrapy\http\response\__init__.py", line 30, in meta
return self.request.meta
AttributeError: 'NoneType' object has no attribute 'meta'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python37\lib\site-packages\twisted\internet\defer.py", line 1418, in _inlineCallbacks
result = g.send(result)
File "C:\Program Files\Python37\lib\site-packages\scrapy\core\downloader\middleware.py", line 53, in process_response
spider=spider)
File "C:\Users\user\Desktop\try_scrapy_Snippet.py", line 11, in process_response
print('in response:', response.url, response.meta)
File "C:\Program Files\Python37\lib\site-packages\scrapy\http\response\__init__.py", line 33, in meta
"Response.meta not available, this response "
AttributeError: Response.meta not available, this response is not tied to any request
Is this right behavior? process_response
can’t access response.meta
???
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Scrapy crawlera bug - Stack Overflow
I think scrapy_crawlera should access meta differently ... AttributeError: Response.meta not available, this response is not tied to any ...
Read more >Requests and Responses — Scrapy 2.7.1 documentation
Scrapy uses Request and Response objects for crawling web sites. ... and can also be accessed, in your spider, from the response.meta ......
Read more >Python process response - ProgramCreek.com
This page shows Python code examples for process response. ... is None: return response; # No CAPTCHA is present elif request.meta.get(RETRY_KEY, self.
Read more >Release Scrapy developers
At this point Python 2.7 and pip package manager must be working, ... This method is responsible for parsing the response data and ......
Read more >Scrapy 2.6.1 documentation
As mentioned above, the received Response object will contain the text of the link that produced the Request in its meta dictionary (under...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It is not, it’s an implementation detail. Downloader middlewares sit between the downloader and the engine (see https://doc.scrapy.org/en/latest/topics/architecture.html). As the second link I posted shows, the request gets bound to the response in the engine, and by the time your
process_response
method is executed the response hasn’t reached the engine yet.you’re right! Thanks!