refacto
This commit is contained in:
parent
ab1a169d45
commit
618213572f
7 changed files with 260 additions and 96 deletions
18
pdf_downloader.py
Normal file
18
pdf_downloader.py
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue