

def _write_body(self, body):
    if isinstance(body, six.text_type):
        raise GrabMisuseError('Document.body could be only byte string.')
    elif self.body_path:
        with open(self.body_path, 'wb') as out:
            out.write(body)
        self._bytes_body = None
    else:
        self._bytes_body = body
    self._unicode_body = None

dataset/ETHPy150Open lorien/grab/grab/document.py BodyExtension._write_body/original