Code

lyrics/leoslyrics: don't print backtrace on HTTP failure
authorAnthoine Bourgeois <anthoine.bourgeois@gmail.com>
Wed, 21 Jul 2010 06:02:09 +0000 (08:02 +0200)
committerMax Kellermann <max@duempel.org>
Wed, 21 Jul 2010 06:02:09 +0000 (08:02 +0200)
lyrics/30-leoslyrics.py

index 2a40f37a8bab6833a60d248652efa4d5eabf0a1f..87953e81840d598fc8007c90271b4274c2ac800c 100755 (executable)
@@ -43,7 +43,11 @@ def search(artist, title):
                        'artist': artist,
                        'songtitle': title})
     url = "http://api.leoslyrics.com/api_search.php?" + query
-    f = urlopen(url)
+    try:
+        f = urlopen(url)
+    except IOError:
+        stderr.write("Failed to connect to http://api.leoslyrics.com, it seems down!\n")
+        exit(1)
     handler = SearchContentHandler()
     parser = make_parser()
     parser.setContentHandler(handler)