This commit is contained in:
Stanislas Jouffroy 2025-05-20 22:34:36 +02:00
parent ab1a169d45
commit 618213572f
7 changed files with 260 additions and 96 deletions

18
pdf_downloader.py Normal file
View file

@ -0,0 +1,18 @@
import tempfile
from pathlib import Path
import requests
def download(
url: str,
destination_folder: Path = Path(tempfile.mkdtemp()),
file_name: str = "file.pdf",
) -> Path:
response = requests.get(url)
response.raise_for_status()
output_file = destination_folder / file_name
output_file.write_bytes(response.content)
return output_file