Skip to content

Commit

Permalink
Merge pull request #89 from eciavatta/feature/fetch-feed-timeout
Browse files Browse the repository at this point in the history
Add timeout to feed fetch request
  • Loading branch information
Felix83000 authored Dec 14, 2022
2 parents 379a555 + e2ef37a commit 32dd483
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 32dd483

Please sign in to comment.