def to_xml(self): activity_xml = '<?xml version="1.0" encoding="UTF-8"?><activities>' for activity in self.items: xml = activity.to_xml() activity_xml += xml activity_xml += '</activities>' return activity_xml
def publish_activities(self, publisher_name, activities): """Publish activities. @type publisher_name string @param publisher_name string The name of the publisher @type activities list of Activity objects @param activities The activities to publish @return string containing response from the server This method takes in a XML document with a list of activities and sends it to the Gnip server. """ activity_xml = '<?xml version="1.0" encoding="UTF-8"?><activities>' for activity in activities: activity_xml += activity.to_xml() activity_xml += '</activities>' return self.publish_xml(publisher_name, activity_xml)