Download:
child 220:5379500bba11
parent 218:cb7fa90e604d
219:744d45233209
Anton Shestakov <av6@dwimlabs.net>, Wed, 24 Aug 2016 11:53:51 +0800
queue: handle ping event

1 файлов изменено, 10 вставок(+), 0 удалений(-) [+]
hooks-queue.py file | annotate | diff | comparison | revisions
--- a/hooks-queue.py Wed Aug 24 11:20:12 2016 +0800
+++ b/hooks-queue.py Wed Aug 24 11:53:51 2016 +0800
@@ -62,6 +62,13 @@
class GithubHookHandler(BaseHookHandler):
def post(self):
+ event = self.request.headers.get('X-GitHub-Event')
+ getattr(self, 'handle_' + event, self.unknown_event)()
+
+ def handle_ping(self):
+ self.finish({'result': 'pong'})
+
+ def handle_push(self):
payload = json.loads(self.request.body)
base = {
'url': payload['repository']['html_url'],
@@ -76,6 +83,9 @@
self.push(base, changes)
+ def unknown_event(self):
+ self.finish({'result': 'unknown event type'})
+
class CandolintHooks(Application):
def __init__(self, rconn, debug):