A Resource subclass that authenticates Github web hook requests and dispatches to IWebhook implementing plugins.

ParameterssignatureVerifiera callable that accepts two arguments: a twisted.web.http_headers.Headers instance and the bytes body of the corresponding request, and returns True if the request's signature passes verification and False if not. (type: callable)
hooksAn iterable of web hooks to match and possibly run against a request. (type: an iterable of IWebhook-providing objects.)
Method __init__ Undocumented
Method render_POST Verify that request came from Github, then run any matching IWebhooks from self.hooks
Method _extractHeader Extract the first value for name in headers or raise InvalidData.
Method _deserializeContent Deserialize the JSON stored in content.
Method _matchHook Determine if hook matches eventName and eventData.
Method _processHookResults Traverse results and set the response code to 400 if any hooks failed to run.
def __init__(self, signatureVerifier, hooks):
Undocumented
def _extractHeader(self, headers, name):

Extract the first value for name in headers or raise InvalidData.

ParametersheadersThe headers from which to extract the desired value. (type: twisted.web.http_headers.Headers)
nameThe name of the header to extract. (type: bytes)
ReturnsThe first header value under name (type: str, decoded as ASCII.)
RaisesInvalidData if the header is missing, or if its first value cannot be decoded as ASCII.
def _deserializeContent(self, content):

Deserialize the JSON stored in content.

ParameterscontentThe serialized JSON to deserialize (type: bytes)
Returnsthe deserialized JSON object. (type: dict)
RaisesInvalidData if a JSON object cannot be decoded.
def _matchHook(self, hook, eventName, eventData):

Determine if hook matches eventName and eventData.

Parametershookthe web hook to try to match against eventName and eventData (type: an IWebhook-providing object)
eventNamethe name of the Github webhook event (type: str)
eventDatathe event data for this Github webhook event. (type: dict)
ReturnsTrue if the hook matched and False if not.
def _processHookResults(self, results, hooks, request, requestID):

Traverse results and set the response code to 400 if any hooks failed to run.

Intended to be run as added as a callback to a twisted.internet.defer.DeferredList of hook results.

ParametersresultsThe results of running each hook in hooks against request (type: A list of (index, (outcome, value)) tuples.)
hooksan iterable of IWebhook-providing objects that were run against request (type: iterable of IWebhook-providing objects.)
requestthe Github web hook request. (type: twisted.web.server.Request)
requestIDthe Github ID for request (type: str)
def render_POST(self, request):

Verify that request came from Github, then run any matching IWebhooks from self.hooks

ParametersrequestThe request to verify and match hooks against. (type: twisted.web.server.Request)
ReturnsNOT_DONE_YET (type: NOT_DONE_YET)
API Documentation for txghbot, generated by pydoctor at 2016-10-15 18:50:32.