Skip to content

Commit

Permalink
Add timeout to fetch feed request
Browse files Browse the repository at this point in the history
  • Loading branch information
eciavatta committed Dec 14, 2022
1 parent 379a555 commit e2ef37a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Watcher/Watcher/threats_watcher/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def fetch_last_posts(nb_max_post):
posts_published = dict()
for url in rss_urls:
try:
feed_content = requests.get(url)
feed_content = requests.get(url, timeout=60)
feeds.append(feedparser.parse(feed_content.text))
except requests.exceptions.RequestException as e:
print(str(timezone.now()) + " - ", e)
Expand Down Expand Up @@ -181,7 +181,7 @@ def remove_banned_words():
word = word.replace("'", "")
# Remove '/' (sometimes regular expression don't catch this character)
word = word.replace("/", "")

if word:
posts_without_banned[word] = count

Expand Down

0 comments on commit e2ef37a

Please sign in to comment.