Skip to content

Commit

Permalink
Added request timeout support
Browse files Browse the repository at this point in the history
  • Loading branch information
StealthTech committed Jul 18, 2017
1 parent b48a9eb commit b1a7a49
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rssutils/rssutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from bs4 import BeautifulSoup

_rss_word_pattern = '([^a-z]|^)rss([^a-z]|$)'
__request_get_timeout = 5 # Request timeout in seconds


def search_rss_meta(html):
Expand Down Expand Up @@ -49,7 +50,7 @@ def get_content(url):
error = None
r = ''
try:
r = requests.get(url)
r = requests.get(url, timeout=__request_get_timeout)
if r.status_code != 200:
error = r.status_code
except:
Expand Down

0 comments on commit b1a7a49

Please sign in to comment.