mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-10 13:49:32 +01:00
Added a timeout to lyrics fetching
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
# along with Headphones. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import re
|
||||
import urllib
|
||||
import urllib, urllib2
|
||||
from xml.dom import minidom
|
||||
import htmlentitydefs
|
||||
|
||||
@@ -30,7 +30,7 @@ def getLyrics(artist, song):
|
||||
searchURL = 'http://lyrics.wikia.com/api.php?' + urllib.urlencode(params)
|
||||
|
||||
try:
|
||||
data = urllib.urlopen(searchURL).read()
|
||||
data = urllib2.urlopen(searchURL, timeout=20).read()
|
||||
except Exception, e:
|
||||
logger.warn('Error opening: %s. Error: %s' % (searchURL, e))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user