Skip to content

Commit

Permalink
Add timeout to urllib.urlopen
Browse files Browse the repository at this point in the history
  • Loading branch information
C0rby authored Apr 20, 2019
1 parent 0a9a12a commit 0b0142d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rezeptionistin.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def geturlsfrommsg(self, message):
def getpage(self, url):
try:
req = urllib2.Request(url, headers={ 'User-Agent': self.useragent })
soup = BeautifulSoup(urllib2.urlopen(req),"html.parser")
soup = BeautifulSoup(urllib2.urlopen(req, timeout=3),"html.parser")
except:
soup = None

Expand Down

0 comments on commit 0b0142d

Please sign in to comment.