OSDN Git Service

Add HTTP header output.
[fukui-no-namari/fukui-no-namari.git] / src / FukuiNoNamari / board_data.py
index 227c72a..c381921 100644 (file)
@@ -27,7 +27,7 @@ import itertools
 import cachefile
 import idxfile
 import misc
-from http_sub import HTTPRedirectHandler302
+from http_sub import HTTPRedirectHandler302, HTTPDebugHandler
 
 BOARD_DATA_INVALID_VALUE = 0
 REG_EXPR = re.compile("(?P<id>.*).dat<>(?P<title>.*)\((?P<res>\d*)\)")
@@ -167,13 +167,11 @@ class BoardData:
 
         # get subject.txt
 
-        opener = urllib2.build_opener(HTTPRedirectHandler302)
+        opener = urllib2.build_opener(HTTPRedirectHandler302, HTTPDebugHandler)
         try:
             response = opener.open(self.bbs_type.get_subject_txt_uri())
         except urllib2.HTTPError, e:
-            print "%d %s" % (e.code, e.msg)
             gobject.idle_add(self.set_status, "%d %s" % (e.code, e.msg))
-            print e.info()
             print "switch to local"
             self._load_subjecttxt(func)
         except urllib2.URLError, e:
@@ -183,10 +181,8 @@ class BoardData:
             self._load_subjecttxt(func)
         else:
             status = "%d %s" % (response.code, response.msg)
-            print status
             gobject.idle_add(self.set_status, status)
             info = response.info()
-            print info
 
             lastmod = 0
             if "Last-Modified" in info: