Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def testHtmlAndBack(self):
html_string = self.x.get_html_string()
new_table = from_html(html_string)[0]
assert new_table.get_string() == self.x.get_string()
def printCourseTable(course):
if course == '':
return
utils = Utils()
url = utils.getUrl(course)
if url == '':
return
if url.find('ocw.mit.edu') != -1:
r = requests.get(url + '/calendar/')
if r.status_code == 404:
print 'page not found'
return
#table = prettytable.from_html(r.text)[2]
for table in prettytable.from_html(r.text):
if table.field_names[0] == 'Field 1':
continue
table.align['TOPICS'] = 'l'
print table
elif url.find('itunes.apple.com') != -1:
r = requests.get(url)
soup = BeautifulSoup(r.text)
table = soup.find('table', class_='tracklist-table content sortable total-flexible-columns-2 total-columns-6')
parser = TableHandler()
parser.setMaxCellWidth(cell_width)
parser.feed(table.prettify().replace('Video', ''))
parser.tables[0].align["Name"] = "l"
parser.tables[0].align["Description"] = "l"
#print parser.tables[0].field_names
#parser.tables[0].sortby = parser.tables[0].field_names[3]
#parser.tables[0].reversesort = True