in cassette/http_response.py [0:0]
def from_dict(cls, data):
"""Create object from dict."""
# Hack to ensure backwards compatibility with older versions of the
# that did not have the length and version attributes.
data.setdefault('length', len(data['content']))
data.setdefault('version', 10)
obj = cls()
for k in cls.attrs:
setattr(obj, k, data[k])
obj.fp = cls.create_file_descriptor(obj.content)
obj.msg = HTTPMessage(io.StringIO(unicode()), 0)
for k, v in obj.headers.iteritems():
obj.msg.addheader(k, v)
obj.msg.headers = data["raw_headers"]
return obj