Skip to content

Commit

Permalink
fix path (langchain-ai#1168)
Browse files Browse the repository at this point in the history
  • Loading branch information
hwchase17 authored and zachschillaci27 committed Mar 8, 2023
1 parent 36f070c commit f515a3c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions langchain/document_loaders/online_pdf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Loader that loads online PDF files."""

import tempfile
from pathlib import Path
from typing import List

import requests
Expand All @@ -21,9 +22,9 @@ def load(self) -> List[Document]:
"""Load documents."""
r = requests.get(self.web_path)
with tempfile.TemporaryDirectory() as temp_dir:
file_path = f"{temp_dir}/online_file.pdf"
file_path = Path(temp_dir) / "online_file.pdf"
file = open(file_path, "wb")
file.write(r.content)
file.close()
loader = UnstructuredPDFLoader(file_path)
loader = UnstructuredPDFLoader(str(file_path))
return loader.load()

0 comments on commit f515a3c

Please sign in to comment.