unify http request and base http#209
Merged
christinadomanskaya merged 8 commits intomainfrom Apr 12, 2022
Merged
Conversation
SyrexMinus
reviewed
Mar 15, 2022
smart_kit/action/http.py
Outdated
| self.behavior = items.get("behavior") | ||
|
|
||
| def preprocess(self, user, text_processing, params): | ||
| behavior_description = user.descriptions["behaviors"][self.behavior] |
Collaborator
There was a problem hiding this comment.
По-моему, если не указать в items behavior, то эта строчка уронит апп.
Возможный фикс:
Suggested change
| behavior_description = user.descriptions["behaviors"][self.behavior] | |
| behavior_description = user.descriptions["behaviors"].get(self.behavior) |
SyrexMinus
reviewed
Mar 15, 2022
smart_kit/action/http.py
Outdated
| def preprocess(self, user, text_processing, params): | ||
| behavior_description = user.descriptions["behaviors"][self.behavior] | ||
| self.http_action.method_params.setdefault("timeout", behavior_description.timeout(user)) | ||
| self.method_params.setdefault("timeout", behavior_description.timeout(user)) |
Collaborator
There was a problem hiding this comment.
А если self.behavior не указан? Вызов атрибута timeout от None?
SyrexMinus
suggested changes
Mar 15, 2022
Collaborator
SyrexMinus
left a comment
There was a problem hiding this comment.
Всё ок, но нужен тест на случай, когда не указан behavior.
SyrexMinus
reviewed
Mar 15, 2022
smart_kit/action/http.py
Outdated
| self.method_params.setdefault("timeout", behavior_description.timeout(user)) | ||
| behavior_description = user.descriptions["behaviors"].get(self.behavior) | ||
| if behavior_description: | ||
| self.method_params.setdefault("timeout", behavior_description.timeout(user)) |
Collaborator
There was a problem hiding this comment.
Без тайм-аута будет нехорошо. Надо поставить хоть какой-то.
SyrexMinus
reviewed
Mar 15, 2022
SyrexMinus
approved these changes
Mar 18, 2022
christinadomanskaya
approved these changes
Apr 12, 2022
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Объединил HTTPRequestAction и BaseHTTPRequestAction на основе HTTPRequestAction.
Это нужно для того чтобы не изменять структуру ответа и оставить её единой для всех экшенов (BaseHTTPRequestAction возвращал ответ, а в сигнатуре метода run у всех экешенов: Optional[List[Command]]).