예제 #1
0
'''
from asPY import Encoder, ActivityStreamsObject, ActivityStreamsEntry, ActivityStreamsAuthor

stream = Encoder.Encoder('http://samplecompany.com/tasks/activity/',
                         'Task activities at Sample Company')

object = ActivityStreamsObject.ActivityStreamsObject(object_type='ARTICLE')
object.setProperty('id', 'http://samplecompany.com/tasks/23432/')
object.setProperty('title', 'Sample task.')
object.setProperty('content', '...')
object.addObjectType('task')
object.addObjectType('note')
object.setProperty('link', 'http://samplecompany.com/tasks/23432/')

author = ActivityStreamsAuthor.ActivityStreamsAuthor(name="kouklaki")
author.setProperty('name', 'Roger Taylor')
author.setProperty('uri', 'http://samplecompany.com/people/Roger+Taylor/')

entry = ActivityStreamsEntry.ActivityStreamsEntry()
entry.addVerb("update")
entry.title = "Roger Taylor completed a task."
entry.id = 'http://samplecompany.com/tasks/activity/23432/'
entry.addReadyObject(object)
#entry.addObject(object)
entry.addReadyAuthor(author)

stream.addEntry(entry)

#    header('Content type: text/xml')
#    echo $stream
print stream.toString()
예제 #2
0
 def message6(self):
     
     entry=ActivityStreamsEntry("idofEntry","NameofEntry")
     entry.addAuthor(author_name="Iosif Alvertis", author_uri="padgets:http://www.ppadgets.eu/alvertisjo", author_id="342342342", author_link="http://www.ppadgets.eu/alvertisjo")
     entry.addCampaign(id="idCampaign", name="campaignName", uri="padgets:idcampaignURI")
     entry.addVerb(activity_verb="post")
     entry.addObject(object_name="My Status", object_type="status", object_summary="this is a test entry summary", object_content="This is the content of the message")
     entry.addInReplyToObject(id="replyID", name="this is the reply name", url="http://thisistherplyURL.com", object_type="Comment", summary="This is a summary of the reply")
     entry.addTarget(object_name="My article", object_type="article", object_summary="this is a test target article", object_content="This is the content of the article")
     entry.addTargetPlatform(platform_name="Facebook", account_email="*****@*****.**", account_username="******", is_final_platform=False)
     entry.addTargetPlatformPages(pageID="page1ID", pageName="My Page name")
     entry.addTargetPlatformPages(pageID="page2ID", pageName="My Page name no2")
     entry.addTargetPlatform(platform_name="Yahoo", account_email="*****@*****.**", account_username="******", is_final_platform=True)
     
     return entry.getAtom()
예제 #3
0
    def message3(self):

        entry = ActivityStreamsEntry("idofEntry", "NameofEntry")
        entry.addAuthor(author_name="Iosif Alvertis",
                        author_uri="padgets:http://www.ppadgets.eu/alvertisjo",
                        author_id="342342342",
                        author_link="http://www.ppadgets.eu/alvertisjo")
        entry.addCampaign(id="idCampaign",
                          name="campaignName",
                          uri="padgets:idcampaignURI")
        entry.addVerb(activity_verb="post")
        entry.addObject(object_name="My Status",
                        object_type="status",
                        object_summary="this is a test entry summary",
                        object_content="This is the content of the message")
        entry.addInReplyToObject(id="replyID",
                                 name="this is the reply name",
                                 url="http://thisistherplyURL.com",
                                 object_type="Comment",
                                 summary="This is a summary of the reply")
        entry.addTarget(object_name="My article",
                        object_type="article",
                        object_summary="this is a test target article",
                        object_content="This is the content of the article")
        entry.addTargetPlatform(platform_name="Facebook",
                                account_email="*****@*****.**",
                                account_username="******",
                                is_final_platform=False)
        entry.addTargetPlatformPages(pageID="page1ID", pageName="My Page name")
        entry.addTargetPlatformPages(pageID="page2ID",
                                     pageName="My Page name no2")
        entry.addTargetPlatform(platform_name="Yahoo",
                                account_email="*****@*****.**",
                                account_username="******",
                                is_final_platform=True)

        return entry.getAtom()