http.hook#

class platypush.message.event.http.hook.WebhookEvent(*argv, hook, method, data=None, args=None, headers=None, response=None, **kwargs)[source]#

Bases: Event

Event triggered when a custom webhook is called.

__init__(*argv, hook, method, data=None, args=None, headers=None, response=None, **kwargs)[source]#
Parameters:
  • hook (str) – Name of the invoked web hook, from http://host:port/hook/<hook>

  • method (str) – HTTP method (in uppercase)

  • data (str or dict/list from JSON) – Extra data passed over POST/PUT/DELETE

  • args (dict | list | str) – Extra query string arguments

  • headers – Request headers

  • response – Response returned by the hook.

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object