forked from platypush/platypush
Added headers argument to webhook event
This commit is contained in:
parent
a0bf227573
commit
fddf2006e4
2 changed files with 7 additions and 3 deletions
|
@ -26,6 +26,7 @@ def _hook(hook_name):
|
|||
'method': request.method,
|
||||
'args': dict(request.args or {}),
|
||||
'data': request.data.decode(),
|
||||
'headers': request.headers,
|
||||
}
|
||||
|
||||
if event_args['data']:
|
||||
|
|
|
@ -5,7 +5,7 @@ class WebhookEvent(Event):
|
|||
Event triggered when a custom webhook is called.
|
||||
"""
|
||||
|
||||
def __init__(self, hook, method, data=None, args=None, *argv, **kwargs):
|
||||
def __init__(self, *argv, hook, method, data=None, args=None, headers=None, **kwargs):
|
||||
"""
|
||||
:param hook: Name of the invoked web hook, from http://host:port/hook/<hook>
|
||||
:type hook: str
|
||||
|
@ -18,10 +18,13 @@ class WebhookEvent(Event):
|
|||
|
||||
:param args: Extra query string arguments
|
||||
:type args: dict
|
||||
|
||||
:param headers: Request headers
|
||||
:type args: dict
|
||||
"""
|
||||
|
||||
super().__init__(hook=hook, method=method, data=data, args=args or {}, *argv, **kwargs)
|
||||
super().__init__(hook=hook, method=method, data=data, args=args or {},
|
||||
headers=headers or {}, *argv, **kwargs)
|
||||
|
||||
|
||||
# vim:sw=4:ts=4:et:
|
||||
|
||||
|
|
Loading…
Reference in a new issue