def _get_html(self): url_opener = URLOpener() response = url_opener.open(self.url) if lxml: html = lxml.html.parse(response).getroot() else: html = html5lib.parse(response) return html
def _get_departure_data(self): base_url = ('http://livetimes.transperth.wa.gov.au/LiveTimes.asmx' '/GetSercoTimesForStation') params = {'stationname': '%s Stn' % (self.name)} url = '%s?%s' % (base_url, urlencode(params)) url_opener = URLOpener() response = url_opener.open(url) tree = ElementTree.parse(response) return tree.getroot()
def _get_html(self): url_opener = URLOpener() response = url_opener.open(self.url) html = lxml.html.parse(response).getroot() return html