#NEWLINE# def get_report_metadata( self ) : #NEWLINE# #INDENT# 'Extract the DMARC metadata as defined here: \n\t\thttp://www.dmarc.org/draft-dmarc-base-00-02.txt in Appendix C\n\t\tIf no data is found, return NA\n\t\t' #NEWLINE# orgName = self . doc . findtext ( 'report_metadata/org_name' , default = 'NA' ) #NEWLINE# email = self . doc . findtext ( 'report_metadata/email' , default = 'NA' ) #NEWLINE# extraContactInfo = self . doc . findtext ( 'report_metadata/extra_contact_info' , default = 'NA' ) #NEWLINE# reportID = self . doc . findtext ( 'report_metadata/report_id' , default = 'NA' ) #NEWLINE# dateRangeBegin = self . doc . findtext ( 'report_metadata/date_range/begin' , default = 'NA' ) #NEWLINE# dateRangeBegin = int ( self ) #NEWLINE# dateRangeEnd = self . doc . findtext ( 'report_metadata/date_range/end' , default = 'NA' ) #NEWLINE# dateRangeEnd = int ( dateRangeEnd ) #NEWLINE# 'Insert report metadata' #NEWLINE# sql = ( 'INSERT INTO report_metadata(organization, email, extra_contact_information, report_id, date_range_begin, date_range_end) \n\t\t\t\t\tVALUES("%s", "%s", "%s", "%s", %d, %d)' % ( orgName , email , extraContactInfo , reportID , dateRangeBegin , dateRangeEnd ) ) #NEWLINE# try : #NEWLINE# #INDENT# self . cursor . execute ( sql ) #NEWLINE# self . db . commit ( ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# self . db . rollback ( ) #NEWLINE# #UNINDENT# self . metadata_fk = self . cursor . lastrowid