Skip to content
This repository has been archived by the owner on Jan 25, 2019. It is now read-only.

Commit

Permalink
add wptserve app
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob Holt committed Feb 1, 2017
1 parent 413c6e7 commit 9d34756
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions wptserve_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""Flask server to listen for Travis webhooks and post GitHub PR comments."""

import urllib

from webhook_handler import webhook_handler
from wptserve import server
from wptserve.handlers import handler


@handler
def travis_handler(request, response):
"""Respond with the output of the webhook handler."""
payload = urllib.unquote_plus(request.body).split('payload=')[1]
signature = request.headers.get('signature')
message, code = webhook_handler(payload, signature)
return code, [("Content-Type", "text/plain")], message


httpd = server.WebTestHttpd(host='45.55.224.178',
doc_root='.',
port=80,
routes=[
("POST", "/prbuildbot/travis/", travis_handler)
])

if __name__ == '__main__':
httpd.start(block=True)

0 comments on commit 9d34756

Please sign in to comment.