assistants.learning_locker¶
This file contains all communication from and to Learning Locker.
Module Contents¶
-
exception
assistants.learning_locker.LearningLockerException¶ Bases:
ExceptionLearning Locker exception.
-
assistants.learning_locker.connect(url, resp_code, method, headers=None, params=None, json=None)¶ Get all the statements matching the parameters.
- Parameters
url (str) – Url location on learning locker.
resp_code (int) – Expected response value.
method (str) – information sending method.
headers (dict) – All additional for the request.
params (dict) – All parameters for the request.
json (dict) – Json data. When added don’t forget to add a header.
- Returns
response data for Learning Locker.
- Return type
Response
-
assistants.learning_locker.get_statements(parameters)¶ Get all the statements matching the parameters.
- Parameters
parameters (dict(str, str)) – All parameters for the request. Can be found on the learning locker get statements page.
- Returns
JSON data for Learning Locker.
rtype: dict
-
assistants.learning_locker.get_viewed_courses(time, course_id)¶ Get all the viewed statements since a certain time.
- Parameters
time (str) – Get all the statements since this time.
course_id (str) – ID of the course.
- Returns
JSON data for Learning Locker.
- Return type
dict
-
assistants.learning_locker.single_statement_deletion(s_id)¶ Delete a statement using its id.
- Parameters
s_id (str) – Statement ID (can be located on the LL platform).
-
assistants.learning_locker.batch_statement_deletion(filter_data)¶ Delete a batch using a filter.
- Parameters
filter_data (dict(str, dict(str, str))) – The filter containing the keywords of statements that need to be removed. example: filter_data = ‘filter’: {‘statement.actor.name’: ‘Admin User’, ‘statement.verb.display.en’: ‘viewed’}
-
assistants.learning_locker.create_statement_forwarder(action, assistant_id=None, query='{}')¶ Create a statement forwarder in Learning Locker.
- Parameters
query (str) – Contains query with what to forward.
action (str) – The action the assistant will be performing e.g. Send Message.
assistant_id (str) – The assistant id.
- Returns
Return the response JSON.
- Return type
dict
-
assistants.learning_locker.delete_statement_forwarder(forwarder_id)¶ Delete a statement forwarder in Learning Locker.
- Parameters
forwarder_id (str) – The id of the statement forwarder.
-
assistants.learning_locker.update_statement_forwarder(forwarder_id, query=None, active=None, description=None, full_document=None)¶ Update a statement forwarder query in Learning Locker.
- Parameters
forwarder_id (str) – The id of the statement forwarder.
query (str) – The query that it should be updated with.
active (str) – The active that it should be updated with.
description (str) – The description that it should be updated with.
full_document (str) – The full_document that it should be updated with.
- Returns
Return the request response
- Return type
dict
-
assistants.learning_locker.get_questions_answered(attempt_id, quiz_id)¶ Get all the questions answered from a certain attempt.
- Parameters
attempt_id (str) – Id of the attempt.
quiz_id (str) – Id of the quiz.
- Returns
Dictionary of external (question_id: True/False) depending on the result of the question.
- Return type
dict
-
assistants.learning_locker.get_sync_agent_forwarder(agent_type)¶ Get the statement forwarder for the sync agent.
- Parameters
agent_type (str) – contains ‘user’ or ‘course’ depending on the type of sync agent.
- Returns
The sync agent forwarder.
- Return type
dict(list(dict(str, str)))
-
assistants.learning_locker.check_statement_forwarder(forwarder_id)¶ Check if a statement forwarder is still in LL.
- Parameters
forwarder_id (str) – Id of the forwarder.
- Returns
If the statement forwarder is in LL.
- Return type
bool
-
assistants.learning_locker.get_all_statement_forwarders()¶ Get all statement forwarders from LL.
- Returns
All statement forwarders.
- Type
json