Skip to content
Snippets Groups Projects
Commit c5445fad authored by Hyunseok_Sang's avatar Hyunseok_Sang
Browse files

파일 다운로드를 위한 클래스 file_downloader.py 추가

parent 559f0b9a
No related branches found
No related tags found
No related merge requests found
import requests
import os
class FileDownloader:
def download_image(self, url, folder_path = '.', file_name = "downloaded_image.png"):
response = requests.get(url)
if response.status_code == 200:
os.makedirs(folder_path, exist_ok=True)
image_path = folder_path+"/"+file_name
with open(image_path, 'wb') as file:
file.write(response.content)
return os.path.normpath(os.path.abspath(image_path))
else:
print(response.status_code)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment