Skip to content

Commit 905568c

Browse files
committed
Fix web_programming/instagram_pic.py
1 parent 32b4721 commit 905568c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

web_programming/instagram_pic.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from datetime import datetime
1+
from datetime import UTC, datetime
22

33
import requests
44
from bs4 import BeautifulSoup
@@ -36,7 +36,7 @@ def download_image(url: str) -> str:
3636
if not image_data:
3737
return f"Failed to download the image from {image_url}."
3838

39-
file_name = f"{datetime.now():%Y-%m-%d_%H:%M:%S}.jpg"
39+
file_name = f"{datetime.now(tz=UTC):%Y-%m-%d_%H:%M:%S}.jpg"
4040
with open(file_name, "wb") as out_file:
4141
out_file.write(image_data)
4242
return f"Image downloaded and saved in the file {file_name}"

0 commit comments

Comments
 (0)