예제 #1
0
def activity_task(activity_json):
    """do something with this json we think is legit"""
    # lets see if the activitypub module can make sense of this json
    activity = activitypub.parse(activity_json)

    # cool that worked, now we should do the action described by the type
    # (create, update, delete, etc)
    activity.action()
예제 #2
0
파일: inbox.py 프로젝트: mmai/bookwyrm
def activity_task(activity_json):
    """ do something with this json we think is legit """
    # lets see if the activitypub module can make sense of this json
    try:
        activity = activitypub.parse(activity_json)
    except activitypub.ActivitySerializerError:
        return

    # cool that worked, now we should do the action described by the type
    # (create, update, delete, etc)
    try:
        activity.action()
    except activitypub.ActivitySerializerError:
        # this is raised if the activity is discarded
        return