コード例 #1
0
 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
コード例 #2
0
ファイル: gnip.py プロジェクト: directeur/gnip-python
    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)