autograder.api.courses.assignments.submissions.proxy.submit
Proxy submit an assignment submission to the autograder.
1""" 2Proxy submit an assignment submission to the autograder. 3""" 4 5import typing 6 7import autograder.api.common 8import autograder.api.config 9import autograder.assignment 10import autograder.error 11import autograder.model.config 12 13API_ENDPOINT: str = 'courses/assignments/submissions/proxy/submit' 14API_WRITE: bool = True 15API_PARAMS: typing.List[autograder.api.config.APIParam] = [ 16 autograder.api.config.PARAM_SERVER, 17 autograder.api.config.PARAM_USER_EMAIL, 18 autograder.api.config.PARAM_USER_PASS, 19 20 autograder.api.config.PARAM_COURSE, 21 autograder.api.config.PARAM_ASSIGNMENT, 22 23 autograder.api.config.PARAM_SUBMISSION_MESSAGE, 24 25 autograder.api.config.PARAM_PROXY_EMAIL, 26 autograder.api.config.PARAM_PROXY_TIME, 27 28 autograder.api.config.PARAM_SUBMISSION_FILES, 29] 30 31def send(config: autograder.model.config.Config, post_paths: typing.Union[typing.List[str], None] = None, **kwargs: typing.Any) -> typing.Tuple[ 32 typing.Dict[str, typing.Any], typing.Union[autograder.assignment.GradedAssignment, None]]: 33 """ 34 Send a request to the autograder. 35 Return the raw response and graded assignment (if grading was successful). 36 """ 37 38 if ((post_paths is None) or len(post_paths) == 0): 39 raise autograder.error.AutograderError("No files provided for submission.") 40 41 response = autograder.api.common.make_api_request(API_ENDPOINT, config, API_PARAMS, write = API_WRITE, post_paths = post_paths, **kwargs) 42 43 assignment = None 44 result = response.get('result', None) 45 if (result is not None): 46 assignment = autograder.assignment.GradedAssignment.from_dict(result) 47 48 return response, assignment
API_ENDPOINT: str =
'courses/assignments/submissions/proxy/submit'
API_WRITE: bool =
True
API_PARAMS: List[autograder.api.config.APIParam] =
[<autograder.api.config.APIParam object>, <autograder.api.config.APIParam object>, <autograder.api.config.APIParam object>, <autograder.api.config.APIParam object>, <autograder.api.config.APIParam object>, <autograder.api.config.APIParam object>, <autograder.api.config.APIParam object>, <autograder.api.config.APIParam object>, <autograder.api.config.APIParam object>]
def
send( config: autograder.model.config.Config, post_paths: Optional[List[str]] = None, **kwargs: Any) -> Tuple[Dict[str, Any], Optional[autograder.assignment.GradedAssignment]]:
32def send(config: autograder.model.config.Config, post_paths: typing.Union[typing.List[str], None] = None, **kwargs: typing.Any) -> typing.Tuple[ 33 typing.Dict[str, typing.Any], typing.Union[autograder.assignment.GradedAssignment, None]]: 34 """ 35 Send a request to the autograder. 36 Return the raw response and graded assignment (if grading was successful). 37 """ 38 39 if ((post_paths is None) or len(post_paths) == 0): 40 raise autograder.error.AutograderError("No files provided for submission.") 41 42 response = autograder.api.common.make_api_request(API_ENDPOINT, config, API_PARAMS, write = API_WRITE, post_paths = post_paths, **kwargs) 43 44 assignment = None 45 result = response.get('result', None) 46 if (result is not None): 47 assignment = autograder.assignment.GradedAssignment.from_dict(result) 48 49 return response, assignment
Send a request to the autograder. Return the raw response and graded assignment (if grading was successful).