We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 32b4721 commit 905568cCopy full SHA for 905568c
web_programming/instagram_pic.py
@@ -1,4 +1,4 @@
1
-from datetime import datetime
+from datetime import UTC, datetime
2
3
import requests
4
from bs4 import BeautifulSoup
@@ -36,7 +36,7 @@ def download_image(url: str) -> str:
36
if not image_data:
37
return f"Failed to download the image from {image_url}."
38
39
- file_name = f"{datetime.now():%Y-%m-%d_%H:%M:%S}.jpg"
+ file_name = f"{datetime.now(tz=UTC):%Y-%m-%d_%H:%M:%S}.jpg"
40
with open(file_name, "wb") as out_file:
41
out_file.write(image_data)
42
return f"Image downloaded and saved in the file {file_name}"
0 commit comments