autograder.api.courses.upsert.zip

Upsert a course using a zip file.

 1"""
 2Upsert a course using a zip file.
 3"""
 4
 5import typing
 6
 7import autograder.api.common
 8import autograder.api.config
 9import autograder.error
10import autograder.model.config
11
12API_ENDPOINT: str = 'courses/upsert/zip'
13API_WRITE: bool = True
14API_PARAMS: typing.List[autograder.api.config.APIParam] = [
15    autograder.api.config.PARAM_SERVER,
16    autograder.api.config.PARAM_USER_EMAIL,
17    autograder.api.config.PARAM_USER_PASS,
18
19    autograder.api.config.PARAM_DRY_RUN,
20    autograder.api.config.PARAM_SKIP_EMAILS,
21    autograder.api.config.PARAM_SKIP_SOURCE_SYNC,
22    autograder.api.config.PARAM_SKIP_LMS_SYNC,
23    autograder.api.config.PARAM_SKIP_BUILD_IMAGES,
24    autograder.api.config.PARAM_SKIP_TEMPLATE_FILES,
25
26    autograder.api.config.PARAM_UPSERT_ZIP,
27]
28
29def send(
30        config: autograder.model.config.Config,
31        post_paths: typing.Union[typing.List[str], None] = None,
32        **kwargs: typing.Any,
33        ) -> typing.Dict[str, typing.Any]:
34    """ Send a request to the autograder. """
35
36    if ((post_paths is None) or len(post_paths) == 0):
37        raise autograder.error.AutograderError("No files provided for upsert.")
38
39    if (len(post_paths) > 1):
40        raise autograder.error.AutograderError(f"Too many files ({len(post_paths)}) provided for upsert, expecting exactly one.")
41
42    return autograder.api.common.make_api_request(API_ENDPOINT, config, API_PARAMS, write = API_WRITE, post_paths = post_paths, **kwargs)
API_ENDPOINT: str = 'courses/upsert/zip'
API_WRITE: bool = True
def send( config: autograder.model.config.Config, post_paths: Optional[List[str]] = None, **kwargs: Any) -> Dict[str, Any]:
30def send(
31        config: autograder.model.config.Config,
32        post_paths: typing.Union[typing.List[str], None] = None,
33        **kwargs: typing.Any,
34        ) -> typing.Dict[str, typing.Any]:
35    """ Send a request to the autograder. """
36
37    if ((post_paths is None) or len(post_paths) == 0):
38        raise autograder.error.AutograderError("No files provided for upsert.")
39
40    if (len(post_paths) > 1):
41        raise autograder.error.AutograderError(f"Too many files ({len(post_paths)}) provided for upsert, expecting exactly one.")
42
43    return autograder.api.common.make_api_request(API_ENDPOINT, config, API_PARAMS, write = API_WRITE, post_paths = post_paths, **kwargs)

Send a request to the autograder.