# 课程 API

此章节是关于课程 API 的描述。

## `Course` objects

[`Course`](#course-objects) 对象提供了一系列课程信息 API。

**Constructor**:

*class* hdu\_api.**Course**(*session*)

|    参数   |           type          | required | default |             备注             |
| :-----: | :---------------------: | :------: | :-----: | :------------------------: |
| session | objects `CourseSession` |   true   |    无    | 一个已初始化的 `CourseSession` 对象 |

**Class methods**:

* *classmethod* Course.**selected**(*year, term, raw=False, dictionary=DEFAULT\_DICTIONARY*)

    已选课程。
* *classmethod* Course.**selected\_current**(*raw=False, dictionary=DEFAULT\_DICTIONARY*)

    本学期已选课程。
* *classmethod* Course.**schedule**(*year, term, raw=False, dictionary=DEFAULT\_DICTIONARY*)

    课表。
* *classmethod* Course.**schedule\_current**(*raw=False, dictionary=DEFAULT\_DICTIONARY*)

    本学期课表。

参数说明：

* raw - 是否输出为原始格式
* dictionary - raw 为 true 时，使用该字典替换返回数据的 key
* year - 学年，格式如 '2018-2019'
* term - 学期，1 表示第一个学期，2 表示第二个学期

**Class attributes**:

* Course.**session**

    `CourseSession` 对象。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://liuxingran.gitbook.io/hdu-api/apis/course.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
