HTML page needs to be UTF-8
dblume

dblume commited on 2024-08-03 16:45:45
Showing 1 changed files, with 16 additions and 13 deletions.

... ...
@@ -42,6 +42,7 @@ localdir = ''
42 42
 
43 43
 html_head = """<!DOCTYPE html>
44 44
 <html><head>
45
+  <meta charset="UTF-8">
45 46
   <title>TechCrunch Feed Filter</title>
46 47
   <!-- <link rel="alternate" type="application/rss+xml" title="RSS feed" href="http://techcrunch.dlma.com/rss_feed.xml" /> -->
47 48
   <link rel="alternate" type="application/rss+xml" title="RSS feed" href="http://feeds.feedburner.com/TrendingAtTechcrunch" />
... ...
@@ -251,20 +252,22 @@ def process_feed(yaml_items):
251 252
             if isinstance(e, urllib.error.URLError):
252 253
                 print_last_line = True
253 254
                 if hasattr(e, 'reason'):
254
-                    if e.reason[0] == 110:
255
-                        print("the feed's connection timed out.")
256
-                        print_last_line = False
257
-                    elif e.reason[0] == 111:
258
-                        print("the feed's connection was refused.")
259
-                        print_last_line = False
260
-                    elif e.reason[0] == 104:
261
-                        print("the feed reset the connection.")
262
-                        print_last_line = False
263
-                    else:
264
-                        print("the feed had a URLError with reason %s." % (str(e.reason),))
265
-                        print_last_line = False
255
+                    print(f'The feed had a bozo_exception with {e.reason=}')
256
+#                if hasattr(e, 'reason'):
257
+#                    if e.reason[0] == 110:
258
+#                        print("the feed's connection timed out.")
259
+#                        print_last_line = False
260
+#                    elif e.reason[0] == 111:
261
+#                        print("the feed's connection was refused.")
262
+#                        print_last_line = False
263
+#                    elif e.reason[0] == 104:
264
+#                        print("the feed reset the connection.")
265
+#                        print_last_line = False
266
+#                    else:
267
+#                        print("the feed had a URLError with reason %s." % (str(e.reason),))
268
+#                        print_last_line = False
266 269
                 if print_last_line:
267
-                    print("the feed had a URLError %s" % (str(e),))
270
+                    print(f"the feed had a URLError {str(e)}")
268 271
             elif isinstance(e, http.client.BadStatusLine):
269 272
                 print("the feed gave a bad status line. (%s)" % (str(e),))
270 273
             else:
271 274