4 import xml.etree.ElementTree as ET
6 class stevens_pass_conditions_renderer(renderer.debuggable_abstaining_renderer):
7 def __init__(self, name_to_timeout_dict, feed_site, feed_uris):
8 super(stevens_pass_conditions_renderer, self).__init__(
9 name_to_timeout_dict, False)
10 self.feed_site = feed_site
11 self.feed_uris = feed_uris
13 def debug_prefix(self):
16 def periodic_render(self, key):
17 f = file_writer.file_writer('stevens-conditions_1_86400.html')
18 for uri in self.feed_uris:
19 self.conn = http.client.HTTPSConnection(self.feed_site)
24 {"Accept-Charset": "utf-8"})
25 response = self.conn.getresponse()
26 if response.status == 200:
28 rss = ET.fromstring(raw)
30 for item in channel.getchildren():
31 if item.tag == "title":
32 f.write("<h1>%s</h1><hr>" % item.text)
33 f.write('<IMG WIDTH=512 ALIGN=RIGHT HEIGHT=382 SRC="https://images.wsdot.wa.gov/nc/002vc06430.jpg?t=637059938785646824" style="padding:8px;">')
34 elif item.tag == "item":
35 for x in item.getchildren():
36 if x.tag == "description":
38 text = text.replace("<strong>Stevens Pass US2</strong><br/>", "")
39 text = text.replace("<br/><br/>", "<BR>")
40 text = text.replace("<strong>Elevation Meters:</strong>1238<BR>", "")
41 f.write('<P>\n%s\n' % text)