Closed arcsector closed 4 years ago
My call with gunicorn is gunicorn --bind 0.0.0.0:4000 app:app &
and app.py
in the same directory looks like this:
import os
from flask import Flask
from flask_githubapp import GitHubApp
app = Flask(__name__)
app.config['GITHUBAPP_ID'] = 188
app.config['GITHUBAPP_KEY'] = '''-----BEGIN RSA PRIVATE KEY-----
MYKEY
----END RSA PRIVATE KEY-----'''
app.config['GITHUBAPP_SECRET'] = 'MYSECRET'
app.config['GITHUBAPP_URL'] = 'URL.github.com/api/v3'
app.config['GITHUBAPP_ROUTE'] = '/event_handler'
github_app = GitHubApp(app)
@github_app.on('issues.opened')
def cruel_closer():
owner = github_app.payload['repository']['owner']['login']
repo = github_app.payload['repository']['name']
num = github_app.payload['issue']['number']
issue = github_app.installation_client.issue(owner, repo, num)
issue.create_comment('Could not replicate.')
issue.close()
Are you still running into issues?
I'm actually unable to replicate this 😄
(flask-githubapp) my-computer:cruel_closer me$ cat app.py
import os
from flask import Flask
from flask_githubapp import GitHubApp
app = Flask(__name__)
app.config['GITHUBAPP_ID'] = 188
app.config['GITHUBAPP_KEY'] = '''-----BEGIN RSA PRIVATE KEY-----
MYKEY
----END RSA PRIVATE KEY-----'''
app.config['GITHUBAPP_SECRET'] = 'MYSECRET'
app.config['GITHUBAPP_URL'] = 'URL.github.com/api/v3'
app.config['GITHUBAPP_ROUTE'] = '/event_handler'
github_app = GitHubApp(app)
@github_app.on('issues.opened')
def cruel_closer():
owner = github_app.payload['repository']['owner']['login']
repo = github_app.payload['repository']['name']
num = github_app.payload['issue']['number']
issue = github_app.installation_client.issue(owner, repo, num)
issue.create_comment('Could not replicate.')
issue.close()
(flask-githubapp) my-computer:cruel_closer me$ gunicorn --bind 0.0.0.0:4000 app:app
[2019-06-27 20:36:33 -0500] [53742] [INFO] Starting gunicorn 19.9.0
[2019-06-27 20:36:33 -0500] [53742] [INFO] Listening at: http://0.0.0.0:4000 (53742)
[2019-06-27 20:36:33 -0500] [53742] [INFO] Using worker: sync
[2019-06-27 20:36:33 -0500] [53745] [INFO] Booting worker with pid: 53745
Hi,
I'm running python 3.6 with gunicorn 18 on CentOS 7. What about you?
Trying to use gunicorn with this, i found that it doesn't boot, with the message "Application object must be callable." Is this a known issue after running
GitHubApp(app)
?