API Reference¶
Client¶
- class jp_diet_search.client.DietClient(*, base_url: str = 'https://kokkai.ndl.go.jp/api', user_agent: str = 'jp-diet-search', timeout: float = 20.0, sleep_seconds: float = 0.0, cache_dir: str | Path | None = None, session: Session | None = None)[source]¶
Bases:
objectObject API client for the NDL Diet Records API.
- jp_diet_search.client.DietSearchClient¶
alias of
DietClient
Queries¶
- class jp_diet_search.queries.BaseQuery(*, start_record: Annotated[int | None, Ge(ge=1)] = None, maximum_records: Annotated[int | None, Ge(ge=1)] = None, record_packing: Literal['json', 'xml'] | None = 'json', name_of_house: str | None = None, name_of_meeting: str | None = None, any: str | None = None, speaker: str | None = None, from_date: str | None = None, until: str | None = None, supplement_and_appendix: bool | None = None, contents_and_index: bool | None = None, search_range: str | None = None, closing: bool | None = None, speech_number: int | None = None, speaker_position: str | None = None, speaker_group: str | None = None, speaker_role: str | None = None, speech_id: str | None = None, issue_id: str | None = None, session_from: int | None = None, session_to: int | None = None, issue_from: int | None = None, issue_to: int | None = None)[source]¶
Bases:
BaseModelBase query object for the Diet Search API.
This class is intentionally strict (extra=”forbid”) so typos are caught early.
- any: str | None¶
- closing: bool | None¶
- contents_and_index: bool | None¶
- from_date: str | None¶
- issue_from: int | None¶
- issue_id: str | None¶
- issue_to: int | None¶
- maximum_records: int | None¶
- model_config = {'extra': 'forbid', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name_of_house: str | None¶
- name_of_meeting: str | None¶
- record_packing: RecordPacking | None¶
- search_range: str | None¶
- session_from: int | None¶
- session_to: int | None¶
- speaker: str | None¶
- speaker_group: str | None¶
- speaker_position: str | None¶
- speaker_role: str | None¶
- speech_id: str | None¶
- speech_number: int | None¶
- start_record: int | None¶
- supplement_and_appendix: bool | None¶
- until_date: str | None¶
- class jp_diet_search.queries.MeetingListQuery(*, start_record: Annotated[int | None, Ge(ge=1)] = None, maximum_records: Annotated[int | None, Ge(ge=1)] = None, record_packing: Literal['json', 'xml'] | None = 'json', name_of_house: str | None = None, name_of_meeting: str | None = None, any: str | None = None, speaker: str | None = None, from_date: str | None = None, until: str | None = None, supplement_and_appendix: bool | None = None, contents_and_index: bool | None = None, search_range: str | None = None, closing: bool | None = None, speech_number: int | None = None, speaker_position: str | None = None, speaker_group: str | None = None, speaker_role: str | None = None, speech_id: str | None = None, issue_id: str | None = None, session_from: int | None = None, session_to: int | None = None, issue_from: int | None = None, issue_to: int | None = None)[source]¶
Bases:
BaseQuery- model_config = {'extra': 'forbid', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class jp_diet_search.queries.MeetingQuery(*, start_record: Annotated[int | None, Ge(ge=1)] = None, maximum_records: Annotated[int | None, Ge(ge=1)] = None, record_packing: Literal['json', 'xml'] | None = 'json', name_of_house: str | None = None, name_of_meeting: str | None = None, any: str | None = None, speaker: str | None = None, from_date: str | None = None, until: str | None = None, supplement_and_appendix: bool | None = None, contents_and_index: bool | None = None, search_range: str | None = None, closing: bool | None = None, speech_number: int | None = None, speaker_position: str | None = None, speaker_group: str | None = None, speaker_role: str | None = None, speech_id: str | None = None, issue_id: str | None = None, session_from: int | None = None, session_to: int | None = None, issue_from: int | None = None, issue_to: int | None = None)[source]¶
Bases:
BaseQuery- model_config = {'extra': 'forbid', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class jp_diet_search.queries.SpeechQuery(*, start_record: Annotated[int | None, Ge(ge=1)] = None, maximum_records: Annotated[int | None, Ge(ge=1)] = None, record_packing: Literal['json', 'xml'] | None = 'json', name_of_house: str | None = None, name_of_meeting: str | None = None, any: str | None = None, speaker: str | None = None, from_date: str | None = None, until: str | None = None, supplement_and_appendix: bool | None = None, contents_and_index: bool | None = None, search_range: str | None = None, closing: bool | None = None, speech_number: int | None = None, speaker_position: str | None = None, speaker_group: str | None = None, speaker_role: str | None = None, speech_id: str | None = None, issue_id: str | None = None, session_from: int | None = None, session_to: int | None = None, issue_from: int | None = None, issue_to: int | None = None)[source]¶
Bases:
BaseQuery- model_config = {'extra': 'forbid', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Endpoints¶
- class jp_diet_search.endpoints.MeetingEndpoint(core: _DietCore)[source]¶
Bases:
object- search(query: MeetingQuery, *, limit_total: int | None = None) Dict[str, Any][source]¶
- class jp_diet_search.endpoints.MeetingListEndpoint(core: _DietCore)[source]¶
Bases:
object- search(query: MeetingListQuery, *, limit_total: int | None = None) Dict[str, Any][source]¶
Exceptions¶
- exception jp_diet_search.exceptions.DietSearchAPIError(message: str, details: List[str] | None = None)[source]¶
Bases:
DietSearchErrorServer/API-side errors (HTTP errors, API error payloads).
- exception jp_diet_search.exceptions.DietSearchError[source]¶
Bases:
ExceptionBase exception for jp-diet-search.
- exception jp_diet_search.exceptions.DietSearchParseError[source]¶
Bases:
DietSearchRequestErrorRaised when API responses cannot be parsed or decoded.
- exception jp_diet_search.exceptions.DietSearchRateLimitError(message: str, details: List[str] | None = None)[source]¶
Bases:
DietSearchAPIErrorRaised when the API signals rate limiting (e.g. HTTP 429).
- exception jp_diet_search.exceptions.DietSearchRequestError[source]¶
Bases:
DietSearchErrorClient-side errors (invalid params, misuse, parse failures).