Define last_seen at the beginning, remove write for nothing in except statement
This commit is contained in:
parent
783f3f7813
commit
233ccc6448
1 changed files with 3 additions and 2 deletions
|
@ -15,12 +15,13 @@ def main() -> None:
|
||||||
|
|
||||||
last_seen_file_path = os.path.expanduser("~/.cache/arch_linux_news_last_seen")
|
last_seen_file_path = os.path.expanduser("~/.cache/arch_linux_news_last_seen")
|
||||||
|
|
||||||
|
last_seen = ""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(last_seen_file_path, "r") as last_seen_file:
|
with open(last_seen_file_path, "r") as last_seen_file:
|
||||||
last_seen = last_seen_file.read().strip()
|
last_seen = last_seen_file.read().strip()
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
with open(last_seen_file_path, "w") as last_seen_file:
|
pass
|
||||||
last_seen_file.write("")
|
|
||||||
|
|
||||||
url = "https://www.archlinux.org/feeds/news/"
|
url = "https://www.archlinux.org/feeds/news/"
|
||||||
feed = feedparser.parse(url)
|
feed = feedparser.parse(url)
|
||||||
|
|
Loading…
Add table
Reference in a new issue