Pickled Responses should include a None value for the raw attribute - #1949
Conversation
|
Yep, this is a good catch. We should fix this up. |
|
I don't think we should add a I'd argue it should be present and set to |
Some people will assume that .raw() is present, and they shouldn't get AttributeErrors when they make that assumption on a pickled Response. However, @kennethreitz has asked that we not be too dependent on urllib3. For that reason, set to None.
|
Can I get review from @sigmavirus24 and @ionrock? |
Pickled Responses should include a None value for the raw attribute
|
This seems to fix things in CacheControl. Thank you @Lukasa! My reasoning for suggesting the With that said, Thanks for fixing this so quickly. I'll add some docs in CacheControl to help communicate that a cached response's |
|
Not that you needed it, but 👍. Also we should document this for others relying on pickling and using libraries like multiprocessing (which pickle objects). |
I received this issue in CacheControl where a pickled response throws an error because there is no raw attribute on the response object. The
__setstate__function should set this explicitly to an emptyurllib3.response.HTTPResponse.