def parse_note(data): note_dict = {} note_base = data.get_children() note_dict.update({"server_id": note_base[0].text}) note_elements = note_base[1].get_children() for element in note_elements: if element.tag == "airsyncbase:Body": body = airsyncbase_Body() body.parse(element) note_dict.update({"airsyncbase_Body": body}) elif element.tag == "notes:Subject": note_dict.update({"notes_Subject": element.text}) elif element.tag == "notes:MessageClass": note_dict.update({"notes_MessageClass": element.text}) elif element.tag == "notes:LastModifiedDate": note_dict.update({"notes_LastModifiedDate": element.text}) elif element.tag == "notes:Categories": categories_list = [] categories = element.get_children() for category_element in categories: categories_list.append(category_element.text) note_dict.update({"notes_Categories": categories_list}) return note_dict
def parse_note(data): note_dict = {} note_base = data.get_children() note_dict.update({"server_id" : note_base[0].text}) note_elements = note_base[1].get_children() for element in note_elements: if element.tag == "airsyncbase:Body": body = airsyncbase_Body() body.parse(element) note_dict.update({ "airsyncbase_Body" : body }) elif element.tag == "notes:Subject": note_dict.update({ "notes_Subject" : element.text }) elif element.tag == "notes:MessageClass": note_dict.update({ "notes_MessageClass" : element.text }) elif element.tag == "notes:LastModifiedDate": note_dict.update({ "notes_LastModifiedDate" : element.text }) elif element.tag == "notes:Categories": categories_list = [] categories = element.get_children() for category_element in categories: categories_list.append(category_element.text) note_dict.update({ "notes_Categories" : categories_list }) return note_dict
def parse_calendar(data): calendar_dict = {} calendar_base = data.get_children() calendar_dict.update({"server_id": calendar_base[0].text}) calendar_elements = calendar_base[1].get_children() for element in calendar_elements: if element.tag == "calendar:AllDayEvent": calendar_dict.update({"calendar_AllDayEvent": element.text}) elif element.tag == "calendar:AppointmentReplyTime": calendar_dict.update( {"calendar_AppointmentReplyTime": element.text}) elif element.tag == "calendar:Attendees": attendees_list = [] for attendee in element.get_children(): attendee_dict = {} for attendee_element in attendee.get_children(): if attendee_element.tag == "calendar:AttendeeStatus": attendee_dict.update( {"calendar_AttendeeStatus": attendee_element.text}) elif attendee_element.tag == "calendar:AttendeeType": attendee_dict.update( {"calendar_AttendeeType": attendee_element.text}) elif attendee_element.tag == "calendar:Name": attendee_dict.update( {"calendar_Name": attendee_element.text}) elif attendee_element.tag == "calendar:Email": attendee_dict.update( {"calendar_Email": attendee_element.text}) attendees_list.append(attendee_dict) calendar_dict.update({"calendar_Attendees": attendees_list}) elif element.tag == "airsyncbase:Body": body = airsyncbase_Body() body.parse(element) calendar_dict.update({"airsyncbase_Body": body}) elif element.tag == "calendar:BusyStatus": calendar_dict.update({"calendar_BusyStatus": element.text}) elif element.tag == "calendar:Categories": categories_list = [] categories = element.get_children() for category_element in categories: categories_list.append(category_element.text) calendar_dict.update({"calendar_Categories": categories_list}) elif element.tag == "calendar:DisallowNewTimeProposal": calendar_dict.update( {"calendar_DisallowNewTimeProposal": element.text}) elif element.tag == "calendar:DtStamp": calendar_dict.update({"calendar_DtStamp": element.text}) elif element.tag == "calendar:EndTime": calendar_dict.update({"calendar_EndTime": element.text}) elif element.tag == "calendar:Exceptions": exceptions_list = [] for recurrence_exception in element.get_children(): exception_dict = {} for exception_element in recurrence_exception.get_children(): if exception_element.tag == "calendar:Deleted": exception_dict.update( {"calendar_Deleted": exception_element.text}) elif exception_element.tag == "calendar:ExceptionStartTime": exception_dict.update({ "calendar_ExceptionStartTime": exception_element.text }) elif exception_element.tag == "calendar:AllDayEvent": exception_dict.update( {"calendar_AllDayEvent": exception_element.text}) elif exception_element.tag == "calendar:AppointmentReplyTime": exception_dict.update({ "calendar_AppointmentReplyTime": exception_element.text }) elif exception_element.tag == "calendar:Attendees": attendees_list = [] for attendee in element.get_children(): attendee_dict = {} for attendee_element in attendee.get_children(): if attendee_element.tag == "calendar:AttendeeStatus": attendee_dict.update({ "calendar_AttendeeStatus": attendee_element.text }) elif attendee_element.tag == "calendar:AttendeeType": attendee_dict.update({ "calendar_AttendeeType": attendee_element.text }) elif attendee_element.tag == "calendar:Name": attendee_dict.update({ "calendar_Name": attendee_element.text }) elif attendee_element.tag == "calendar:Email": attendee_dict.update({ "calendar_Email": attendee_element.text }) attendees_list.append(attendee_dict) exception_dict.update( {"calendar_Attendees": attendees_list}) elif exception_element.tag == "airsyncbase:Body": body = airsyncbase_Body() body.parse(element) exception_dict.update({"airsyncbase_Body": body}) elif exception_element.tag == "calendar:BusyStatus": exception_dict.update( {"calendar_BusyStatus": exception_element.text}) elif exception_element.tag == "calendar:Categories": categories_list = [] categories = element.get_children() for category_element in categories: categories_list.append(category_element.text) exception_dict.update( {"calendar_Categories": categories_list}) elif exception_element.tag == "calendar:StartTime": exception_dict.update( {"calendar_StartTime": exception_element.text}) elif exception_element.tag == "calendar:OnlineMeetingConfLink": exception_dict.update({ "calendar_OnlineMeetingConfLink": exception_element.text }) elif exception_element.tag == "calendar:OnlineMeetingExternalLink": exception_dict.update({ "calendar_OnlineMeetingExternalLink": exception_element.text }) elif exception_element.tag == "calendar:ResponseType": exception_dict.update( {"calendar_ResponseType": exception_element.text}) elif exception_element.tag == "calendar:Location": exception_dict.update( {"calendar_Location": exception_element.text}) elif exception_element.tag == "calendar:MeetingStatus": exception_dict.update( {"calendar_MeetingStatus": exception_element.text}) elif exception_element.tag == "calendar:EndTime": exception_dict.update( {"calendar_EndTime": exception_element.text}) elif exception_element.tag == "calendar:DtStamp": exception_dict.update( {"calendar_DtStamp": exception_element.text}) elif exception_element.tag == "calendar:Sensitivity": exception_dict.update( {"calendar_Sensitivity": exception_element.text}) elif exception_element.tag == "calendar:Reminder": exception_dict.update( {"calendar_Reminder": exception_element.text}) elif exception_element.tag == "calendar:Subject": exception_dict.update( {"calendar_Subject": exception_element.text}) exceptions_list.append(exception_dict) calendar_dict.update({"calendar_Exceptions": exceptions_list}) elif element.tag == "calendar:Location": calendar_dict.update({"calendar_Location": element.text}) elif element.tag == "calendar:MeetingStatus": calendar_dict.update({"calendar_MeetingStatus": element.text}) elif element.tag == "airsyncbase:NativeBodyType": calendar_dict.update({"airsyncbase_NativeBodyType": element.text}) elif element.tag == "calendar:OnlineMeetingConfLink": calendar_dict.update( {"calendar_OnlineMeetingConfLink": element.text}) elif element.tag == "calendar:OnlineMeetingExternalLink": calendar_dict.update( {"calendar_OnlineMeetingExternalLink": element.text}) elif element.tag == "calendar:OrganizerEmail": calendar_dict.update({"calendar_OrganizerEmail": element.text}) elif element.tag == "calendar:OrganizerName": calendar_dict.update({"calendar_OrganizerName": element.text}) elif element.tag == "calendar:Recurrence": recurrence_dict = {} for recurrence_element in element.get_children(): if recurrence_element.tag == "calendar:Type": recurrence_dict.update( {"calendar_Type": recurrence_element.text}) elif recurrence_element.tag == "calendar:Occurrences": recurrence_dict.update( {"calendar_Occurrences": recurrence_element.text}) elif recurrence_element.tag == "calendar:FirstDayOfWeek": recurrence_dict.update( {"calendar_FirstDayOfWeek": recurrence_element.text}) elif recurrence_element.tag == "calendar:Interval": recurrence_dict.update( {"calendar_Interval": recurrence_element.text}) elif recurrence_element.tag == "calendar:IsLeapMonth": recurrence_dict.update( {"calendar_IsLeapMonth": recurrence_element.text}) elif recurrence_element.tag == "calendar:WeekOfMonth": recurrence_dict.update( {"calendar_WeekOfMonth": recurrence_element.text}) elif recurrence_element.tag == "calendar:DayOfMonth": recurrence_dict.update( {"calendar_DayOfMonth": recurrence_element.text}) elif recurrence_element.tag == "calendar:DayOfWeek": recurrence_dict.update( {"calendar_DayOfWeek": recurrence_element.text}) elif recurrence_element.tag == "calendar:MonthOfYear": recurrence_dict.update( {"calendar_MonthOfYear": recurrence_element.text}) elif recurrence_element.tag == "calendar:Until": recurrence_dict.update( {"calendar_Until": recurrence_element.text}) elif recurrence_element.tag == "calendar:CalendarType": recurrence_dict.update( {"calendar_CalendarType": recurrence_element.text}) calendar_dict.update({"calendar_Recurrence": recurrence_dict}) elif element.tag == "calendar:Reminder": calendar_dict.update({"calendar_Reminder": element.text}) elif element.tag == "calendar:ResponseRequested": calendar_dict.update({"calendar_ResponseRequested": element.text}) elif element.tag == "calendar:ResponseType": calendar_dict.update({"calendar_ResponseType": element.text}) elif element.tag == "calendar:Sensitivity": calendar_dict.update({"calendar_Sensitivity": element.text}) elif element.tag == "calendar:StartTime": calendar_dict.update({"calendar_StartTime": element.text}) elif element.tag == "calendar:Subject": calendar_dict.update({"calendar_Subject": element.text}) elif element.tag == "calendar:Timezone": calendar_dict.update({"calendar_Timezone": element.text}) elif element.tag == "calendar:UID": calendar_dict.update({"calendar_UID": element.text}) return calendar_dict
def parse_calendar(data): calendar_dict = {} calendar_base = data.get_children() calendar_dict.update({"server_id" : calendar_base[0].text}) calendar_elements = calendar_base[1].get_children() for element in calendar_elements: if element.tag == "calendar:AllDayEvent": calendar_dict.update({ "calendar_AllDayEvent" : element.text }) elif element.tag == "calendar:AppointmentReplyTime": calendar_dict.update({ "calendar_AppointmentReplyTime" : element.text }) elif element.tag == "calendar:Attendees": attendees_list = [] for attendee in element.get_children(): attendee_dict = {} for attendee_element in attendee.get_children(): if attendee_element.tag == "calendar:AttendeeStatus": attendee_dict.update({ "calendar_AttendeeStatus" : attendee_element.text }) elif attendee_element.tag == "calendar:AttendeeType": attendee_dict.update({ "calendar_AttendeeType" : attendee_element.text }) elif attendee_element.tag == "calendar:Name": attendee_dict.update({ "calendar_Name" : attendee_element.text }) elif attendee_element.tag == "calendar:Email": attendee_dict.update({ "calendar_Email" : attendee_element.text }) attendees_list.append(attendee_dict) calendar_dict.update({ "calendar_Attendees" : attendees_list }) elif element.tag == "airsyncbase:Body": body = airsyncbase_Body() body.parse(element) calendar_dict.update({ "airsyncbase_Body" : body }) elif element.tag == "calendar:BusyStatus": calendar_dict.update({ "calendar_BusyStatus" : element.text }) elif element.tag == "calendar:Categories": categories_list = [] categories = element.get_children() for category_element in categories: categories_list.append(category_element.text) calendar_dict.update({ "calendar_Categories" : categories_list }) elif element.tag == "calendar:DisallowNewTimeProposal": calendar_dict.update({ "calendar_DisallowNewTimeProposal" : element.text }) elif element.tag == "calendar:DtStamp": calendar_dict.update({ "calendar_DtStamp" : element.text }) elif element.tag == "calendar:EndTime": calendar_dict.update({ "calendar_EndTime" : element.text }) elif element.tag == "calendar:Exceptions": exceptions_list = [] for recurrence_exception in element.get_children(): exception_dict = {} for exception_element in recurrence_exception.get_children(): if exception_element.tag == "calendar:Deleted": exception_dict.update({ "calendar_Deleted" : exception_element.text }) elif exception_element.tag == "calendar:ExceptionStartTime": exception_dict.update({ "calendar_ExceptionStartTime" : exception_element.text }) elif exception_element.tag == "calendar:AllDayEvent": exception_dict.update({ "calendar_AllDayEvent" : exception_element.text }) elif exception_element.tag == "calendar:AppointmentReplyTime": exception_dict.update({ "calendar_AppointmentReplyTime" : exception_element.text }) elif exception_element.tag == "calendar:Attendees": attendees_list = [] for attendee in element.get_children(): attendee_dict = {} for attendee_element in attendee.get_children(): if attendee_element.tag == "calendar:AttendeeStatus": attendee_dict.update({ "calendar_AttendeeStatus" : attendee_element.text }) elif attendee_element.tag == "calendar:AttendeeType": attendee_dict.update({ "calendar_AttendeeType" : attendee_element.text }) elif attendee_element.tag == "calendar:Name": attendee_dict.update({ "calendar_Name" : attendee_element.text }) elif attendee_element.tag == "calendar:Email": attendee_dict.update({ "calendar_Email" : attendee_element.text }) attendees_list.append(attendee_dict) exception_dict.update({ "calendar_Attendees" : attendees_list }) elif exception_element.tag == "airsyncbase:Body": body = airsyncbase_Body() body.parse(element) exception_dict.update({ "airsyncbase_Body" : body }) elif exception_element.tag == "calendar:BusyStatus": exception_dict.update({ "calendar_BusyStatus" : exception_element.text }) elif exception_element.tag == "calendar:Categories": categories_list = [] categories = element.get_children() for category_element in categories: categories_list.append(category_element.text) exception_dict.update({ "calendar_Categories" : categories_list }) elif exception_element.tag == "calendar:StartTime": exception_dict.update({ "calendar_StartTime" : exception_element.text }) elif exception_element.tag == "calendar:OnlineMeetingConfLink": exception_dict.update({ "calendar_OnlineMeetingConfLink" : exception_element.text }) elif exception_element.tag == "calendar:OnlineMeetingExternalLink": exception_dict.update({ "calendar_OnlineMeetingExternalLink" : exception_element.text }) elif exception_element.tag == "calendar:ResponseType": exception_dict.update({ "calendar_ResponseType" : exception_element.text }) elif exception_element.tag == "calendar:Location": exception_dict.update({ "calendar_Location" : exception_element.text }) elif exception_element.tag == "calendar:MeetingStatus": exception_dict.update({ "calendar_MeetingStatus" : exception_element.text }) elif exception_element.tag == "calendar:EndTime": exception_dict.update({ "calendar_EndTime" : exception_element.text }) elif exception_element.tag == "calendar:DtStamp": exception_dict.update({ "calendar_DtStamp" : exception_element.text }) elif exception_element.tag == "calendar:Sensitivity": exception_dict.update({ "calendar_Sensitivity" : exception_element.text }) elif exception_element.tag == "calendar:Reminder": exception_dict.update({ "calendar_Reminder" : exception_element.text }) elif exception_element.tag == "calendar:Subject": exception_dict.update({ "calendar_Subject" : exception_element.text }) exceptions_list.append(exception_dict) calendar_dict.update({ "calendar_Exceptions" : exceptions_list }) elif element.tag == "calendar:Location": calendar_dict.update({ "calendar_Location" : element.text }) elif element.tag == "calendar:MeetingStatus": calendar_dict.update({ "calendar_MeetingStatus" : element.text }) elif element.tag == "airsyncbase:NativeBodyType": calendar_dict.update({ "airsyncbase_NativeBodyType" : element.text }) elif element.tag == "calendar:OnlineMeetingConfLink": calendar_dict.update({ "calendar_OnlineMeetingConfLink" : element.text }) elif element.tag == "calendar:OnlineMeetingExternalLink": calendar_dict.update({ "calendar_OnlineMeetingExternalLink" : element.text }) elif element.tag == "calendar:OrganizerEmail": calendar_dict.update({ "calendar_OrganizerEmail" : element.text }) elif element.tag == "calendar:OrganizerName": calendar_dict.update({ "calendar_OrganizerName" : element.text }) elif element.tag == "calendar:Recurrence": recurrence_dict = {} for recurrence_element in element.get_children(): if recurrence_element.tag == "calendar:Type": recurrence_dict.update({ "calendar_Type" : recurrence_element.text }) elif recurrence_element.tag == "calendar:Occurrences": recurrence_dict.update({ "calendar_Occurrences" : recurrence_element.text }) elif recurrence_element.tag == "calendar:FirstDayOfWeek": recurrence_dict.update({ "calendar_FirstDayOfWeek" : recurrence_element.text }) elif recurrence_element.tag == "calendar:Interval": recurrence_dict.update({ "calendar_Interval" : recurrence_element.text }) elif recurrence_element.tag == "calendar:IsLeapMonth": recurrence_dict.update({ "calendar_IsLeapMonth" : recurrence_element.text }) elif recurrence_element.tag == "calendar:WeekOfMonth": recurrence_dict.update({ "calendar_WeekOfMonth" : recurrence_element.text }) elif recurrence_element.tag == "calendar:DayOfMonth": recurrence_dict.update({ "calendar_DayOfMonth" : recurrence_element.text }) elif recurrence_element.tag == "calendar:DayOfWeek": recurrence_dict.update({ "calendar_DayOfWeek" : recurrence_element.text }) elif recurrence_element.tag == "calendar:MonthOfYear": recurrence_dict.update({ "calendar_MonthOfYear" : recurrence_element.text }) elif recurrence_element.tag == "calendar:Until": recurrence_dict.update({ "calendar_Until" : recurrence_element.text }) elif recurrence_element.tag == "calendar:CalendarType": recurrence_dict.update({ "calendar_CalendarType" : recurrence_element.text }) calendar_dict.update({ "calendar_Recurrence" : recurrence_dict }) elif element.tag == "calendar:Reminder": calendar_dict.update({ "calendar_Reminder" : element.text }) elif element.tag == "calendar:ResponseRequested": calendar_dict.update({ "calendar_ResponseRequested" : element.text }) elif element.tag == "calendar:ResponseType": calendar_dict.update({ "calendar_ResponseType" : element.text }) elif element.tag == "calendar:Sensitivity": calendar_dict.update({ "calendar_Sensitivity" : element.text }) elif element.tag == "calendar:StartTime": calendar_dict.update({ "calendar_StartTime" : element.text }) elif element.tag == "calendar:Subject": calendar_dict.update({ "calendar_Subject" : element.text }) elif element.tag == "calendar:Timezone": calendar_dict.update({ "calendar_Timezone" : element.text }) elif element.tag == "calendar:UID": calendar_dict.update({ "calendar_UID" : element.text }) return calendar_dict
def parse_contact(data): contact_dict = {} contact_base = data.get_children() contact_dict.update({"server_id" : contact_base[0].text}) contact_elements = contact_base[1].get_children() for element in contact_elements: if element.tag == "contacts2:AccountName": contact_dict.update({ "contacts2_AccountName" : element.text }) elif element.tag == "contacts:Alias": contact_dict.update({ "contacts_Alias" : element.text }) elif element.tag == "contacts:Anniversary": contact_dict.update({ "contacts_Anniversary" : element.text }) elif element.tag == "contacts:AssistantName": contact_dict.update({ "contacts_AssistantName" : element.text }) elif element.tag == "contacts:AssistantPhoneNumber": contact_dict.update({ "contacts_AssistantPhoneNumber" : element.text }) elif element.tag == "contacts:Birthday": contact_dict.update({ "contacts_Birthday" : element.text }) elif element.tag == "airsyncbase:Body": body = airsyncbase_Body() body.parse(element) contact_dict.update({ "airsyncbase_Body" : body }) elif element.tag == "contacts:BusinessAddressCity": contact_dict.update({ "contacts_BusinessAddressCity" : element.text }) elif element.tag == "contacts:BusinessAddressCountry": contact_dict.update({ "contacts_BusinessAddressCountry" : element.text }) elif element.tag == "contacts:BusinessAddressPostalCode": contact_dict.update({ "contacts_BusinessAddressPostalCode" : element.text }) elif element.tag == "contacts:BusinessAddressState": contact_dict.update({ "contacts_BusinessAddressState" : element.text }) elif element.tag == "contacts:BusinessAddressStreet": contact_dict.update({ "contacts_BusinessAddressStreet" : element.text }) elif element.tag == "contacts:BusinessFaxNumber": contact_dict.update({ "contacts_BusinessFaxNumber" : element.text }) elif element.tag == "contacts:BusinessPhoneNumber": contact_dict.update({ "contacts_BusinessPhoneNumber" : element.text }) elif element.tag == "contacts:Business2PhoneNumber": contact_dict.update({ "contacts_Business2PhoneNumber" : element.text }) elif element.tag == "contacts:CarPhoneNumber": contact_dict.update({ "contacts_CarPhoneNumber" : element.text }) elif element.tag == "contacts:Categories": categories_list = [] categories = element.get_children() for category_element in categories: categories_list.append(category_element.text) contact_dict.update({ "contacts_Categories" : categories_list }) elif element.tag == "contacts:Children": children_list = [] children = element.get_children() for child_element in children: children_list.append(child_element.text) contact_dict.update({ "contacts_Children" : children_list }) elif element.tag == "contacts2:CompanyMainPhone": contact_dict.update({ "contacts2_CompanyMainPhone" : element.text }) elif element.tag == "contacts:CompanyName": contact_dict.update({ "contacts_CompanyName" : element.text }) elif element.tag == "contacts2:CustomerId": contact_dict.update({ "contacts2_CustomerId" : element.text }) elif element.tag == "contacts:Department": contact_dict.update({ "contacts_Department" : element.text }) elif element.tag == "contacts:Email1Address": contact_dict.update({ "contacts_Email1Address" : element.text }) elif element.tag == "contacts:Email2Address": contact_dict.update({ "contacts_Email2Address" : element.text }) elif element.tag == "contacts:Email3Address": contact_dict.update({ "contacts_Email3Address" : element.text }) elif element.tag == "contacts:FileAs": contact_dict.update({ "contacts_FileAs" : element.text }) elif element.tag == "contacts:FirstName": contact_dict.update({ "contacts_FirstName" : element.text }) elif element.tag == "contacts2:GovernmentId": contact_dict.update({ "contacts2_GovernmentId" : element.text }) elif element.tag == "contacts:HomeAddressCity": contact_dict.update({ "contacts_HomeAddressCity" : element.text }) elif element.tag == "contacts:HomeAddressCountry": contact_dict.update({ "contacts_HomeAddressCountry" : element.text }) elif element.tag == "contacts:HomeAddressPostalCode": contact_dict.update({ "contacts_HomeAddressPostalCode" : element.text }) elif element.tag == "contacts:HomeAddressState": contact_dict.update({ "contacts_HomeAddressState" : element.text }) elif element.tag == "contacts:HomeAddressStreet": contact_dict.update({ "contacts_HomeAddressStreet" : element.text }) elif element.tag == "contacts:HomeFaxNumber": contact_dict.update({ "contacts_HomeFaxNumber" : element.text }) elif element.tag == "contacts:HomePhoneNumber": contact_dict.update({ "contacts_HomePhoneNumber" : element.text }) elif element.tag == "contacts:Home2PhoneNumber": contact_dict.update({ "contacts_Home2PhoneNumber" : element.text }) elif element.tag == "contacts2:IMAddress": contact_dict.update({ "contacts2_IMAddress" : element.text }) elif element.tag == "contacts2:IMAddress2": contact_dict.update({ "contacts2_IMAddress2" : element.text }) elif element.tag == "contacts2:IMAddress3": contact_dict.update({ "contacts_IMAddress3" : element.text }) elif element.tag == "contacts:JobTitle": contact_dict.update({ "contacts_JobTitle" : element.text }) elif element.tag == "contacts:LastName": contact_dict.update({ "contacts_LastName" : element.text }) elif element.tag == "contacts2:ManagerName": contact_dict.update({ "contacts2_ManagerName" : element.text }) elif element.tag == "contacts:MiddleName": contact_dict.update({ "contacts_MiddleName" : element.text }) elif element.tag == "contacts2:MMS": contact_dict.update({ "contacts2_MMS" : element.text }) elif element.tag == "contacts:MobilePhoneNumber": contact_dict.update({ "contacts_MobilePhoneNumber" : element.text }) elif element.tag == "contacts2:NickName": contact_dict.update({ "contacts2_NickName" : element.text }) elif element.tag == "contacts:OfficeLocation": contact_dict.update({ "contacts_OfficeLocation" : element.text }) elif element.tag == "contacts:OtherAddressCity": contact_dict.update({ "contacts_OtherAddressCity" : element.text }) elif element.tag == "contacts:OtherAddressCountry": contact_dict.update({ "contacts_OtherAddressCountry" : element.text }) elif element.tag == "contacts:OtherAddressPostalCode": contact_dict.update({ "contacts_OtherAddressPostalCode" : element.text }) elif element.tag == "contacts:OtherAddressState": contact_dict.update({ "contacts_OtherAddressState" : element.text }) elif element.tag == "contacts:OtherAddressStreet": contact_dict.update({ "contacts_OtherAddressStreet" : element.text }) elif element.tag == "contacts:PagerNumber": contact_dict.update({ "contacts_PagerNumber" : element.text }) elif element.tag == "contacts:Picture": contact_dict.update({ "contacts_Picture" : element.text }) elif element.tag == "contacts:RadioPhoneNumber": contact_dict.update({ "contacts_RadioPhoneNumber" : element.text }) elif element.tag == "contacts:Spouse": contact_dict.update({ "contacts_Spouse" : element.text }) elif element.tag == "contacts:Suffix": contact_dict.update({ "contacts_Suffix" : element.text }) elif element.tag == "contacts:Title": contact_dict.update({ "contacts_Title" : element.text }) elif element.tag == "contacts:WebPage": contact_dict.update({ "contacts_WebPage" : element.text }) elif element.tag == "contacts:WeightedRank": contact_dict.update({ "contacts_WeightedRank" : element.text }) elif element.tag == "contacts:YomiCompanyName": contact_dict.update({ "contacts_YomiCompanyName" : element.text }) elif element.tag == "contacts:YomiFirstName": contact_dict.update({ "contacts_YomiFirstName" : element.text }) elif element.tag == "contacts:YomiLastName": contact_dict.update({ "contacts_YomiLastName" : element.text }) return contact_dict
def parse_contact(data): contact_dict = {} contact_base = data.get_children() contact_dict.update({"server_id": contact_base[0].text}) contact_elements = contact_base[1].get_children() for element in contact_elements: if element.tag == "contacts2:AccountName": contact_dict.update({"contacts2_AccountName": element.text}) elif element.tag == "contacts:Alias": contact_dict.update({"contacts_Alias": element.text}) elif element.tag == "contacts:Anniversary": contact_dict.update({"contacts_Anniversary": element.text}) elif element.tag == "contacts:AssistantName": contact_dict.update({"contacts_AssistantName": element.text}) elif element.tag == "contacts:AssistantPhoneNumber": contact_dict.update( {"contacts_AssistantPhoneNumber": element.text}) elif element.tag == "contacts:Birthday": contact_dict.update({"contacts_Birthday": element.text}) elif element.tag == "airsyncbase:Body": body = airsyncbase_Body() body.parse(element) contact_dict.update({"airsyncbase_Body": body}) elif element.tag == "contacts:BusinessAddressCity": contact_dict.update({"contacts_BusinessAddressCity": element.text}) elif element.tag == "contacts:BusinessAddressCountry": contact_dict.update( {"contacts_BusinessAddressCountry": element.text}) elif element.tag == "contacts:BusinessAddressPostalCode": contact_dict.update( {"contacts_BusinessAddressPostalCode": element.text}) elif element.tag == "contacts:BusinessAddressState": contact_dict.update( {"contacts_BusinessAddressState": element.text}) elif element.tag == "contacts:BusinessAddressStreet": contact_dict.update( {"contacts_BusinessAddressStreet": element.text}) elif element.tag == "contacts:BusinessFaxNumber": contact_dict.update({"contacts_BusinessFaxNumber": element.text}) elif element.tag == "contacts:BusinessPhoneNumber": contact_dict.update({"contacts_BusinessPhoneNumber": element.text}) elif element.tag == "contacts:Business2PhoneNumber": contact_dict.update( {"contacts_Business2PhoneNumber": element.text}) elif element.tag == "contacts:CarPhoneNumber": contact_dict.update({"contacts_CarPhoneNumber": element.text}) elif element.tag == "contacts:Categories": categories_list = [] categories = element.get_children() for category_element in categories: categories_list.append(category_element.text) contact_dict.update({"contacts_Categories": categories_list}) elif element.tag == "contacts:Children": children_list = [] children = element.get_children() for child_element in children: children_list.append(child_element.text) contact_dict.update({"contacts_Children": children_list}) elif element.tag == "contacts2:CompanyMainPhone": contact_dict.update({"contacts2_CompanyMainPhone": element.text}) elif element.tag == "contacts:CompanyName": contact_dict.update({"contacts_CompanyName": element.text}) elif element.tag == "contacts2:CustomerId": contact_dict.update({"contacts2_CustomerId": element.text}) elif element.tag == "contacts:Department": contact_dict.update({"contacts_Department": element.text}) elif element.tag == "contacts:Email1Address": contact_dict.update({"contacts_Email1Address": element.text}) elif element.tag == "contacts:Email2Address": contact_dict.update({"contacts_Email2Address": element.text}) elif element.tag == "contacts:Email3Address": contact_dict.update({"contacts_Email3Address": element.text}) elif element.tag == "contacts:FileAs": contact_dict.update({"contacts_FileAs": element.text}) elif element.tag == "contacts:FirstName": contact_dict.update({"contacts_FirstName": element.text}) elif element.tag == "contacts2:GovernmentId": contact_dict.update({"contacts2_GovernmentId": element.text}) elif element.tag == "contacts:HomeAddressCity": contact_dict.update({"contacts_HomeAddressCity": element.text}) elif element.tag == "contacts:HomeAddressCountry": contact_dict.update({"contacts_HomeAddressCountry": element.text}) elif element.tag == "contacts:HomeAddressPostalCode": contact_dict.update( {"contacts_HomeAddressPostalCode": element.text}) elif element.tag == "contacts:HomeAddressState": contact_dict.update({"contacts_HomeAddressState": element.text}) elif element.tag == "contacts:HomeAddressStreet": contact_dict.update({"contacts_HomeAddressStreet": element.text}) elif element.tag == "contacts:HomeFaxNumber": contact_dict.update({"contacts_HomeFaxNumber": element.text}) elif element.tag == "contacts:HomePhoneNumber": contact_dict.update({"contacts_HomePhoneNumber": element.text}) elif element.tag == "contacts:Home2PhoneNumber": contact_dict.update({"contacts_Home2PhoneNumber": element.text}) elif element.tag == "contacts2:IMAddress": contact_dict.update({"contacts2_IMAddress": element.text}) elif element.tag == "contacts2:IMAddress2": contact_dict.update({"contacts2_IMAddress2": element.text}) elif element.tag == "contacts2:IMAddress3": contact_dict.update({"contacts_IMAddress3": element.text}) elif element.tag == "contacts:JobTitle": contact_dict.update({"contacts_JobTitle": element.text}) elif element.tag == "contacts:LastName": contact_dict.update({"contacts_LastName": element.text}) elif element.tag == "contacts2:ManagerName": contact_dict.update({"contacts2_ManagerName": element.text}) elif element.tag == "contacts:MiddleName": contact_dict.update({"contacts_MiddleName": element.text}) elif element.tag == "contacts2:MMS": contact_dict.update({"contacts2_MMS": element.text}) elif element.tag == "contacts:MobilePhoneNumber": contact_dict.update({"contacts_MobilePhoneNumber": element.text}) elif element.tag == "contacts2:NickName": contact_dict.update({"contacts2_NickName": element.text}) elif element.tag == "contacts:OfficeLocation": contact_dict.update({"contacts_OfficeLocation": element.text}) elif element.tag == "contacts:OtherAddressCity": contact_dict.update({"contacts_OtherAddressCity": element.text}) elif element.tag == "contacts:OtherAddressCountry": contact_dict.update({"contacts_OtherAddressCountry": element.text}) elif element.tag == "contacts:OtherAddressPostalCode": contact_dict.update( {"contacts_OtherAddressPostalCode": element.text}) elif element.tag == "contacts:OtherAddressState": contact_dict.update({"contacts_OtherAddressState": element.text}) elif element.tag == "contacts:OtherAddressStreet": contact_dict.update({"contacts_OtherAddressStreet": element.text}) elif element.tag == "contacts:PagerNumber": contact_dict.update({"contacts_PagerNumber": element.text}) elif element.tag == "contacts:Picture": contact_dict.update({"contacts_Picture": element.text}) elif element.tag == "contacts:RadioPhoneNumber": contact_dict.update({"contacts_RadioPhoneNumber": element.text}) elif element.tag == "contacts:Spouse": contact_dict.update({"contacts_Spouse": element.text}) elif element.tag == "contacts:Suffix": contact_dict.update({"contacts_Suffix": element.text}) elif element.tag == "contacts:Title": contact_dict.update({"contacts_Title": element.text}) elif element.tag == "contacts:WebPage": contact_dict.update({"contacts_WebPage": element.text}) elif element.tag == "contacts:WeightedRank": contact_dict.update({"contacts_WeightedRank": element.text}) elif element.tag == "contacts:YomiCompanyName": contact_dict.update({"contacts_YomiCompanyName": element.text}) elif element.tag == "contacts:YomiFirstName": contact_dict.update({"contacts_YomiFirstName": element.text}) elif element.tag == "contacts:YomiLastName": contact_dict.update({"contacts_YomiLastName": element.text}) return contact_dict
def parse_task(data): task_dict = {} task_base = data.get_children() task_dict.update({"server_id" : task_base[0].text}) task_elements = task_base[1].get_children() for element in task_elements: if element.tag == "airsyncbase:Body": body = airsyncbase_Body() body.parse(element) task_dict.update({ "airsyncbase_Body" : body }) elif element.tag == "tasks:CalendarType": task_dict.update({ "tasks_CalendarType" : element.text }) elif element.tag == "tasks:Categories": categories_list = [] categories = element.get_children() for category_element in categories: categories_list.append(category_element.text) task_dict.update({ "tasks_Categories" : categories_list }) elif element.tag == "tasks:Complete": task_dict.update({ "tasks_Complete" : element.text }) elif element.tag == "tasks:DateCompleted": task_dict.update({ "tasks_DateCompleted" : element.text }) elif element.tag == "tasks:DueDate": task_dict.update({ "tasks_DueDate" : element.text }) elif element.tag == "tasks:Importance": task_dict.update({ "tasks_Importance" : element.text }) elif element.tag == "tasks:OrdinalDate": task_dict.update({ "tasks_OrdinalDate" : element.text }) elif element.tag == "tasks:Recurrence": recurrence_dict = {} for recurrence_element in element.get_children(): if recurrence_element.tag == "tasks:Type": recurrence_dict.update({ "tasks_Type" : recurrence_element.text }) elif recurrence_element.tag == "tasks:Occurrences": recurrence_dict.update({ "tasks_Occurrences" : recurrence_element.text }) elif recurrence_element.tag == "tasks:Regenerate": recurrence_dict.update({ "tasks_Regenerate" : recurrence_element.text }) elif recurrence_element.tag == "tasks:DeadOccur": recurrence_dict.update({ "tasks_DeadOccur" : recurrence_element.text }) elif recurrence_element.tag == "tasks:FirstDayOfWeek": recurrence_dict.update({ "tasks_FirstDayOfWeek" : recurrence_element.text }) elif recurrence_element.tag == "tasks:Interval": recurrence_dict.update({ "tasks_Interval" : recurrence_element.text }) elif recurrence_element.tag == "tasks:IsLeapMonth": recurrence_dict.update({ "tasks_IsLeapMonth" : recurrence_element.text }) elif recurrence_element.tag == "tasks:WeekOfMonth": recurrence_dict.update({ "tasks_WeekOfMonth" : recurrence_element.text }) elif recurrence_element.tag == "tasks:DayOfMonth": recurrence_dict.update({ "tasks_DayOfMonth" : recurrence_element.text }) elif recurrence_element.tag == "tasks:DayOfWeek": recurrence_dict.update({ "tasks_DayOfWeek" : recurrence_element.text }) elif recurrence_element.tag == "tasks:MonthOfYear": recurrence_dict.update({ "tasks_MonthOfYear" : recurrence_element.text }) elif recurrence_element.tag == "tasks:Until": recurrence_dict.update({ "tasks_Until" : recurrence_element.text }) elif recurrence_element.tag == "tasks:Start": recurrence_dict.update({ "tasks_Start" : recurrence_element.text }) elif recurrence_element.tag == "tasks:CalendarType": recurrence_dict.update({ "tasks_CalendarType" : recurrence_element.text }) task_dict.update({ "tasks_Recurrence" : recurrence_dict }) elif element.tag == "tasks:ReminderSet": task_dict.update({ "tasks_ReminderSet" : element.text }) elif element.tag == "tasks:ReminderTime": task_dict.update({ "tasks_ReminderTime" : element.text }) elif element.tag == "tasks:Sensitivity": task_dict.update({ "tasks_Sensitivity" : element.text }) elif element.tag == "tasks:StartDate": task_dict.update({ "tasks_StartDate" : element.text }) elif element.tag == "tasks:Subject": task_dict.update({ "tasks_Subject" : element.text }) elif element.tag == "tasks:SubOrdinalDate": task_dict.update({ "tasks_SubOrdinalDate" : element.text }) elif element.tag == "tasks:UtcDueDate": task_dict.update({ "tasks_UtcDueDate" : element.text }) elif element.tag == "tasks:UtcStartDate": task_dict.update({ "tasks_UtcStartDate" : element.text }) return task_dict