Load the docs into a BytesIO object. Returns: BytesIO: A BytesIO object containing the doc data.
(self)
| 260 | raise ValueError("Unsupported document type from bytes") |
| 261 | |
| 262 | def _load_doc_as_bytesio(self) -> BytesIO: |
| 263 | """ |
| 264 | Load the docs into a BytesIO object. |
| 265 | |
| 266 | Returns: |
| 267 | BytesIO: A BytesIO object containing the doc data. |
| 268 | """ |
| 269 | if self.source.startswith(("http://", "https://")): |
| 270 | response = requests.get(self.source) |
| 271 | response.raise_for_status() |
| 272 | return BytesIO(response.content) |
| 273 | else: |
| 274 | with open(self.source, "rb") as f: |
| 275 | return BytesIO(f.read()) |
| 276 | |
| 277 | @staticmethod |
| 278 | def chunks_from_path_or_bytes( |