-
-
Notifications
You must be signed in to change notification settings - Fork 25
[ADD] base_web_hook: Create abstract web hooks #4
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
Conversation
* Create a module that circumvents the JSON-RPC requirement for all requests with application/json
* Create a module to allow for the receipt of web hooks in an abstract fashion
365114e to
7a6d879
Compare
7a6d879 to
071843b
Compare
|
|
||
| @http.route( | ||
| ['/base_web_hook/<string:slug>'], | ||
| type='json', |
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.
Hmmmm maybe should be an HTTP receiver as well
2e04110 to
c2e781c
Compare
|
Alright this is implemented in a connector, so it's less rough around the edges now. We've still got some testing to do on the connector, and another one to implement, so I would assume there's still work to come here. |
| _name = 'web.hook' | ||
| _description = 'Web Hook' | ||
|
|
||
| name = fields.Char( |
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.
Add UNIQUE(name)
435c307 to
854e366
Compare
a9ae4a8 to
b292801
Compare
b292801 to
e310be4
Compare
|
Alright I've now added a Request Bin hook type, which simply catches and saves inbound requests. This is a useful tool for testing web hooks as an administrator, but will also help me test the module in an automated fashion. |
|
late to the party, are you aware of https://github.com/OCA/server-tools/tree/10.0/webhook ? |
|
Not aware at all. How did you conquer the receipt of JSON? |
|
I didn't conquer anything there, didn't even use the module. But I read it yesterday and decided I can't use it for what I had in mind. |
|
looks straightforward enough: https://github.com/OCA/server-tools/blob/10.0/webhook/controllers/main.py#L17 |
|
I'm looking at the module, and it definitely does not work as intended in most cases. The route is using I would propose this module as a direct successor to the other TBH. There are significantly more features here, such as the ability to receive non-JSON requests & session authenticated hooks. |
|
@moylop260 - your module https://github.com/OCA/server-tools/tree/10.0/webhook has instructions specifically for Github web hooks, but odoo/odoo#7766 alludes to the fact that this does not actual work. Can you confirm OCA/server-tools/webhook does work for any inbound JSON webhook without sitting a proxy in front of the Odoo server? |
pntabuye
left a comment
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.
tested on Odoo 10e and not conclusive. The non JSON-RPC json does not raise a BadRequest error from werkzeug.
| old_init(self, *args) | ||
| except BadRequest as e: | ||
| try: | ||
| args = self.httprequest.args |
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.
AttributeError: 'JsonRequest' object has no attribute 'httprequest'
| :alt: Try me on Runbot | ||
| :target: https://runbot.odoo-community.org/runbot/210/10.0 | ||
|
|
||
| Bug Tracker |
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.
Please add a usage section on how to use this module
| * Security is too lax; public can read too much. Maybe should also add a group for hooks.. | ||
| * Buffer length should be checked before ``httprequest.get_data`` calls | ||
|
|
||
| Bug Tracker |
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.
Please add a usage section on how to use this module
|
sale, old odoo running on python 2 -> closing |
Depends:
This is a PoC.