#NEWLINE# def handle( self , * args , **kwargs ) : #NEWLINE# #INDENT# self . stdout . write ( 'contacting justice ministry website' ) #NEWLINE# page = urllib2 . urlopen ( TABLE_ADDRESS ) #NEWLINE# soup = BeautifulSoup ( page . read ( ) ) #NEWLINE# tbl = soup . find ( 'table' , 'MsoNormalTable' ) #NEWLINE# parser = HTMLParser ( ) #NEWLINE# for row in tbl . findAll ( 'tr' ) : #NEWLINE# #INDENT# text = row . find ( 'td' ) . p . span . string #NEWLINE# if text : #NEWLINE# #INDENT# Party . objects . get_or_create ( name = parser . unescape ( row . find ( 'td' ) . p . span . string ) )