generated from DevCraftClub/template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update Films.py and add Staff.py controller
- Update Films.py to handle month validation and fix return statement - Add Staff.py controller to work with movie staff information - Define methods to get film staff information - Update class documentation for KpFilms in Films.py
- Loading branch information
Showing
2 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from typing import Optional, Any | ||
|
||
from requests import Session | ||
|
||
from NotKinoPoiskAPI.Controller.NKPA import NKPA | ||
from NotKinoPoiskAPI.Responses.StaffResponse import StaffResponse | ||
|
||
|
||
class KpStaff(NKPA): | ||
""" | ||
Класс для работы с сотрудниками фильмов и сериалов. Эндпоийнт /staff | ||
""" | ||
def __init__(api_key: Optional[str] = None, proxy: Optional[Any] = None, user_agent: Optional[str] = None, | ||
headers: Optional[dict] = None, | ||
session: Optional[Session] = None, timeout: int = 5): | ||
super().__init__(api_key, proxy, user_agent, headers, session, timeout) | ||
|
||
def get_staff(self, film_id: int) -> list[StaffResponse]: | ||
""" | ||
Метод для получения информации о сотрудниках фильма | ||
/api/v2.2/films/{id}/staff | ||
:param film_id: ID фильма. | ||
:return list[StaffResponse] | ||
""" | ||
return self.get_data(self.get_api_url('staff', '1', filmId=film_id)) | ||
|
||
|
||
|