|
1 | | -# An example script showing the functionality of the TinCan Python Library |
| 1 | +# An example script showing the functionality of the TinCanPython Library |
2 | 2 |
|
3 | 3 | import uuid |
4 | 4 | from resources import lrs_properties |
5 | | -from tincan.remote_lrs import RemoteLRS |
6 | | -from tincan.statement import Statement |
7 | | -from tincan.agent import Agent |
8 | | -from tincan.verb import Verb |
9 | | -from tincan.activity import Activity |
10 | | -from tincan.context import Context |
11 | | -from tincan.language_map import LanguageMap |
12 | | -from tincan.activity_definition import ActivityDefinition |
13 | | -from tincan.documents import StateDocument |
| 5 | +from tincan import ( |
| 6 | + RemoteLRS, |
| 7 | + Statement, |
| 8 | + Agent, |
| 9 | + Verb, |
| 10 | + Activity, |
| 11 | + Context, |
| 12 | + LanguageMap, |
| 13 | + ActivityDefinition, |
| 14 | + StateDocument, |
| 15 | +) |
14 | 16 |
|
15 | 17 | # construct an LRS |
16 | 18 | print "constructing the LRS..." |
|
41 | 43 | # construct the object of the statement |
42 | 44 | print "constructing the Object..." |
43 | 45 | object = Activity( |
44 | | - id='http://tincanapi.com/TinCanPython/Test/Unit/0', |
| 46 | + id='http://tincanapi.com/TinCanPython/Example/0', |
45 | 47 | definition=ActivityDefinition( |
46 | 48 | name=LanguageMap({'en-US': 'TinCanPython Library'}), |
47 | 49 | description=LanguageMap({'en-US': 'Use of, or interaction with, the TinCanPython Library'}), |
|
55 | 57 | registration=uuid.uuid4(), |
56 | 58 | instructor=Agent( |
57 | 59 | name='Lord TinCan', |
58 | | - mbox='mailto:tincanpython@tincanapi.com', |
| 60 | + mbox='mailto:lordtincan@tincanapi.com', |
59 | 61 | ), |
60 | 62 | #language='en-US', |
61 | 63 | ) |
|
88 | 90 | print "...done" |
89 | 91 |
|
90 | 92 | print "constructing new Statement from retrieved statement data..." |
91 | | -ret_statement = Statement.from_json(response.data) |
| 93 | +ret_statement = response.content |
92 | 94 | print "...done" |
93 | 95 |
|
94 | 96 | # now, using our old statement and our returned statement, we can send multiple statements |
|
102 | 104 |
|
103 | 105 | # we can query our statements using an object |
104 | 106 | # constructing the query object with common fields |
105 | | -# note: more information about queries can be found in the xAPI spec |
106 | | -# https://github.com/adlnet/xAPI-Spec/blob/master/xAPI.md#723-getstatements |
| 107 | +# note: more information about queries can be found in the API documentation: |
| 108 | +# docs/build/html/tincan.html#module-tincan.remote_lrs |
107 | 109 | query = { |
108 | 110 | "agent": actor, |
109 | 111 | "verb": verb, |
|
0 commit comments