Skip to content

Commit

Permalink
fixed pylinting
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoman committed Jan 14, 2024
1 parent cf88778 commit 59bb4f8
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions jobs/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,10 @@ def install():

def fetch_and_insert_feeds(url):
""" Core function """
feed = feedparser.parse(url)
try:
website = feed.feed.title
except Exception:
website = None
data = feedparser.parse(url)
website = data.feed.get('title', None)

for entry in feed.entries:
for entry in data.entries:
# Check if 'published_parsed' exists in the entry
if 'published_parsed' in entry:
published_at = int(time.mktime(entry.published_parsed))
Expand All @@ -70,7 +67,7 @@ def fetch_and_insert_feeds(url):
db.commit()
except sqlite3.IntegrityError:
pass
except Exception as e:
except sqlite3.OperationalError as e:
print(f"ERRORE: {e}")
finally:
db.close()
Expand Down

0 comments on commit 59bb4f8

Please sign in to comment.