SOURCES: pynapi.py http code handling
arekm
arekm at pld-linux.org
Sat Jan 17 20:19:45 CET 2009
Author: arekm Date: Sat Jan 17 19:19:45 2009 GMT
Module: SOURCES Tag: HEAD
---- Log message:
http code handling
---- Files affected:
SOURCES:
pynapi.py (1.8 -> 1.9)
---- Diffs:
================================================================
Index: SOURCES/pynapi.py
diff -u SOURCES/pynapi.py:1.8 SOURCES/pynapi.py:1.9
--- SOURCES/pynapi.py:1.8 Sat Jan 17 19:42:53 2009
+++ SOURCES/pynapi.py Sat Jan 17 20:19:39 2009
@@ -106,11 +106,17 @@
url = "http://napiprojekt.pl/unit_napisy/dl.php?l=PL&f=" + d.hexdigest() + "&t=" + f(d.hexdigest()) + "&v=other&kolejka=false&nick=&pass=&napios=" + os.name
sub = None
+ http_code = None
try:
sub = urllib.urlopen(url)
+ http_code = sub.getcode()
sub = sub.read()
except (IOError, OSError), e:
print >> sys.stderr, "%s: %d/%d: Fetching subtitle failed: %s" % (prog, i, i_total, e)
+ continue
+
+ if http_code != 200:
+ print >> sys.stderr, "%s: %d/%d: Fetching subtitle failed, HTTP code: %s" % (prog, i, i_total, str(http_code))
continue
# XXX: is this standard way for napiproject to signalize error?
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/pynapi.py?r1=1.8&r2=1.9&f=u
More information about the pld-cvs-commit
mailing list