Last active
July 9, 2018 10:51
-
-
Save rubysoho07/33729dec4dcfbb0ef37d05dbe31f9df4 to your computer and use it in GitHub Desktop.
xAPI Example 2. Statement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tincan import Agent, Verb, Activity, ActivityDefinition, LanguageMap, Statement | |
statement = Statement( | |
actor=Agent( | |
name="Test User", | |
mbox="mailto:test@example.org" | |
), | |
verb=Verb( | |
id="https://brindlewaye.com/xAPITerms/verbs/loggedin/", | |
display=LanguageMap({'en-us': 'Log In'}) | |
), | |
object=Activity( | |
id="http://example.org/activity/1", | |
definition=ActivityDefinition( | |
name=LanguageMap({'en-us': 'Test Activity'}) | |
) | |
) | |
) | |
print statement.to_json() | |
# Result | |
""" | |
{ | |
"verb":{ | |
"id":"https://brindlewaye.com/xAPITerms/verbs/loggedin/", | |
"display":{ | |
"en-us":"Log In" | |
} | |
}, | |
"version":"1.0.1", | |
"actor":{ | |
"mbox":"mailto:test@example.org", | |
"name":"Test User", | |
"objectType":"Agent" | |
}, | |
"object":{ | |
"definition":{ | |
"name":{ | |
"en-us":"Test Activity" | |
} | |
}, | |
"id":"http://example.org/activity/1", | |
"objectType":"Activity" | |
} | |
} | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment