-
Notifications
You must be signed in to change notification settings - Fork 51
Add middleware #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add middleware #10
Conversation
deriv_api/deriv_api.py
Outdated
| return send_is_called | ||
| return response | ||
|
|
||
| def _call_middleware(self, name: str, args: dict) -> Union[None,dict]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactor it to the separate class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How ? Could you please give me soem psudo-code ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean write a new middleware class and add this method there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok got your idea.
Let me do it.
But when I implement this feature, in js version I didn't find any place that this feature is used. I suspect it is useless. I even don't know I should keep this feature or not :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
middlewares are useful when used stack-like manner, allowing you to perform actions downstream then filter and manipulate the response upstream. This means in a small workflow like this is not much need but keeping in mind the future, its okay
dfb77ef to
005a2c5
Compare
deriv_api/deriv_api.py
Outdated
| 'deriv_api.deriv_api.DerivAPI.wsconnection': False, | ||
| 'deriv_api.deriv_api.DerivAPI.storage': False | ||
| 'deriv_api.deriv_api.DerivAPI.storage': False, | ||
| 'deriv_api.deriv_api.DerivAPI._call_middleware': False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the naming convention is different from others? Why not use deriv_api.deriv_api.DerivAPI.middleware
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry this is the old name that should be deleted.
will drop it.
No description provided.