Skip to content

Public api meetings#117

Open
Andrey-Krayushkin-1 wants to merge 1 commit into
masterfrom
akr/public-api-meetings
Open

Public api meetings#117
Andrey-Krayushkin-1 wants to merge 1 commit into
masterfrom
akr/public-api-meetings

Conversation

@Andrey-Krayushkin-1

Copy link
Copy Markdown
Contributor

https://pyrus.com/t#id225009663
Паблик апи встреч

@dkuptsov dkuptsov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Спасибо, PR аккуратный и хорошо ложится в стиль либы. Одно замечание, которое стоит поправить до мержа (потенциальный краш), и пара мелочей. Детали — в инлайн-комментариях.

Comment thread pyrus/models/entities.py
if 'type' in kwargs:
self.type = kwargs['type']
if 'start_time' in kwargs:
self.start_time = _set_utc_timezone(datetime.strptime(kwargs['start_time'], constants.DATE_TIME_FORMAT))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нет проверки на None, в отличие от MeetingResponse.start_time, где сделано if 'start_time' in kwargs and kwargs['start_time'] is not None. Если сервер для action_type='deleted' (или иного) пришлёт start_time: null, то strptime(None, ...) упадёт с TypeError. А так как meeting_action парсится при разборе любого комментария задачи, это может уронить get_task/get_comments. Предлагаю выровнять с MeetingResponse:

if 'start_time' in kwargs and kwargs['start_time'] is not None:
    self.start_time = _set_utc_timezone(datetime.strptime(kwargs['start_time'], constants.DATE_TIME_FORMAT))

Comment thread pyrus/models/responses.py
if 'task_ids' in kwargs:
self.task_ids = list(kwargs['task_ids']) if kwargs['task_ids'] is not None else None
if 'members' in kwargs:
self.members = [entities.MeetingMember(**m) for m in kwargs['members']]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут (и в meeting_rooms ниже) list comprehension без guard на null: если поле придёт как null, итерация упадёт. Если сервер гарантирует пустой массив вместо null — некритично, но для надёжности лучше добавить and kwargs['members'] is not None по аналогии с task_ids.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants