From 7107451eba355f1805f73142a4c18df8b2fc3553 Mon Sep 17 00:00:00 2001 From: Redume Date: Fri, 8 Jul 2022 00:08:10 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B0=D0=B2=D1=82=D0=BE=D0=B7=D0=B0=D0=B3=D1=80?= =?UTF-8?q?=D1=83=D0=B7=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 43 ------------------------------------------- requirements.txt | 3 --- 2 files changed, 46 deletions(-) delete mode 100644 main.py delete mode 100644 requirements.txt diff --git a/main.py b/main.py deleted file mode 100644 index 64e3060..0000000 --- a/main.py +++ /dev/null @@ -1,43 +0,0 @@ -from bs4 import BeautifulSoup -import requests - -import ctypes -import os -import urllib -import schedule - - -class Nasa: - - def __init__(self): - self.url = "https://apod.nasa.gov/apod/" - self.headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) ' - 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36'} - self.photoName = "everydayphotonasa.jpg" - - def download_photo(self): - full_page = requests.get(self.url, headers=self.headers) - soup = BeautifulSoup(full_page.content, 'html.parser') - lnk = str - for link in soup.select("img"): - lnk = link["src"] - print(f"Скачиваю картинку — {self.url + lnk}") - - img = urllib.request.urlopen(self.url + lnk).read() - out = open(self.photoName, "wb") - out.write(img) - out.close() - - def set_wallpaper(self): - path = os.path.abspath(self.photoName) - ctypes.windll.user32.SystemParametersInfoW(20, 0, path, 0) - - def start(self): - self.download_photo() - self.set_wallpaper() - - -if __name__ == "__main__": - schedule.every(1).days.do(Nasa().start) - while True: - schedule.run_pending() diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 4f42f6b..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -beautifulsoup4==4.11.1 -requests~=2.28.0 -schedule~=1.1.0 \ No newline at end of file