autograder.api.courses.get

Get a course on a server.

 1"""
 2Get a course on a server.
 3"""
 4
 5import typing
 6
 7import autograder.api.common
 8import autograder.api.config
 9import autograder.model.config
10import autograder.model.course
11
12API_ENDPOINT: str = 'courses/get'
13API_WRITE: bool = False
14API_PARAMS: typing.List[autograder.api.config.APIParam] = [
15    autograder.api.config.PARAM_SERVER,
16    autograder.api.config.PARAM_COURSE,
17    autograder.api.config.PARAM_USER_EMAIL,
18    autograder.api.config.PARAM_USER_PASS,
19]
20
21def send(config: autograder.model.config.Config, **kwargs: typing.Any) -> typing.Union[autograder.model.course.Course, None]:
22    """ Send a request to the autograder. """
23
24    response = autograder.api.common.make_api_request(API_ENDPOINT, config, API_PARAMS, write = API_WRITE, **kwargs)
25
26    if (not response.get('found', False)):
27        return None
28
29    return autograder.model.course.Course.from_api(response['course'])
API_ENDPOINT: str = 'courses/get'
API_WRITE: bool = False
def send( config: autograder.model.config.Config, **kwargs: Any) -> Optional[autograder.model.course.Course]:
22def send(config: autograder.model.config.Config, **kwargs: typing.Any) -> typing.Union[autograder.model.course.Course, None]:
23    """ Send a request to the autograder. """
24
25    response = autograder.api.common.make_api_request(API_ENDPOINT, config, API_PARAMS, write = API_WRITE, **kwargs)
26
27    if (not response.get('found', False)):
28        return None
29
30    return autograder.model.course.Course.from_api(response['course'])

Send a request to the autograder.