1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
gh-webhook-actor/app/server.py

23 lines
522 B
Python
Raw Normal View History

2018-10-25 13:19:46 +01:00
#!/usr/bin/env python3
2018-10-25 20:49:18 +01:00
import logging
2018-10-28 11:20:53 +00:00
import sentry_sdk
2018-10-25 21:06:55 +01:00
from flask import Flask, abort, jsonify
2018-10-25 13:19:46 +01:00
from github_webhook import Webhook
2018-10-28 11:20:53 +00:00
from sentry_sdk.integrations.flask import FlaskIntegration
2018-10-25 13:19:46 +01:00
2018-10-25 20:53:23 +01:00
from . import config
2018-10-25 20:49:18 +01:00
logging.basicConfig(level=logging.INFO)
2018-10-28 11:20:53 +00:00
if config.SENTRY_DSN:
sentry_sdk.init(dsn=config, integrations=[FlaskIntegration()])
2018-10-25 13:19:46 +01:00
app = Flask(__name__)
2018-10-25 20:49:18 +01:00
webhook = Webhook(app, secret=config.GITHUB_WEBHOOK_SECRET)
2018-10-25 13:19:46 +01:00
2018-10-25 21:06:55 +01:00
@webhook.hook(event_type="ping")
def ping(data):
return abort(jsonify({"ping": "pong"}))