Ruff
This commit is contained in:
parent
59b7f4e392
commit
fafb64d57d
|
@ -1,7 +1,6 @@
|
|||
import feedparser
|
||||
import requests
|
||||
import secret_loader
|
||||
import feedparser
|
||||
from markdownify import markdownify
|
||||
|
||||
SESSION = requests.Session()
|
||||
|
||||
|
@ -9,23 +8,27 @@ secrets = secret_loader.SecretLoader()
|
|||
WEBHOOK_URL = secrets.load_or_fail('WEBHOOK_URL')
|
||||
FEED_URL = secrets.load_or_fail('FEED_URL')
|
||||
|
||||
|
||||
def send_feed_notice(text: str):
|
||||
app_message = {"text": text}
|
||||
message_headers = {"Content-Type": "application/json; charset=UTF-8"}
|
||||
app_message = {'text': text}
|
||||
message_headers = {'Content-Type': 'application/json; charset=UTF-8'}
|
||||
response = requests.post(
|
||||
WEBHOOK_URL,
|
||||
headers=message_headers,
|
||||
json=app_message,
|
||||
)
|
||||
|
||||
|
||||
def get_feed():
|
||||
response = SESSION.get(FEED_URL)
|
||||
return feedparser.parse(response.text)
|
||||
|
||||
|
||||
def get_seen_entry_ids() -> set[str]:
|
||||
with open('output/entries_db.txt') as f:
|
||||
return f.read().split('\n')
|
||||
|
||||
|
||||
def mark_as_sent(entry_id: str):
|
||||
with open('output/entries_db.txt', 'a') as f:
|
||||
f.write(entry_id)
|
||||
|
@ -47,5 +50,6 @@ def check_for_new_updates():
|
|||
def main():
|
||||
check_for_new_updates()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Reference in New Issue
Block a user