def unwrap(response): root = ET.fromstring(response.text) activities = [] for activity_el in root.findall('.//activityRecord'): activity = lead_activity.unwrap(activity_el) activities.append(activity) return activities
def unwrap(response): root = ET.fromstring(response.text.encode("utf-8")) activities = [] for activity_el in root.findall('.//activityRecord'): activity = lead_activity.unwrap(activity_el) activities.append(activity) return activities
def unwrap(response): root = ET.fromstring(response.text.encode('utf8')) activities = [] remaining_count_list = root.findall('.//remainingCount') for activity_el in root.findall('.//activityRecord'): activity = lead_activity.unwrap(activity_el) activities.append(activity) remaining = 0 if len(remaining_count_list) > 0: remaining = int(remaining_count_list[0].text) if remaining > 0 and len(activities) > 0: # print 'retrieved [%s] with [%s] remaining' % (len(activities), remaining) new_start = root.findall('.//newStartPosition') else: new_start = None return activities, new_start