是否有 django 记录器的处理程序在创建日志条目时在 github 上创建问题?如果没有,创造一个有多难?
问问题
158 次
1 回答
1
这不是一个完整的“包含电池”的答案,但是,只要你自己付出一点努力,它就会让你到达那里。
- 创建自定义记录器
- 让该自定义记录器在 github 上创建问题(我使用了以下脚本)
创建 Github 问题的脚本:
import json
import requests
def make_issue(title, body=None, assignee=None, milestone=None, labels=None):
'''Create an issue on github.com using the given parameters.'''
# Authentication for user filing issue (must have read/write access to
# repository to add issue to)
username = 'CHANGEME'
password = 'CHANGEME'
# The repository to add this issue to
repo_owner = 'CHANGEME'
repo_name = 'CHANGEME'
# Our url to create issues via POST
url = 'https://api.github.com/repos/%s/%s/issues' % (repo_owner, repo_name)
# Create an authenticated session to create the issue
session = requests.session(auth=(username, password))
# Create our issue
issue = {'title': title,
'body': body,
'assignee': assignee,
'milestone': milestone,
'labels': labels}
# Add the issue to our repository
r = session.post(url, json.dumps(issue))
if r.status_code == 201:
print 'Successfully created Issue "%s"' % title
else:
print 'Could not create Issue "%s"' % title
print 'Response:', r.content
make_issue('Issue Title', 'Body text', 'assigned_user', 3, ['bug'])
于 2012-06-19T15:37:27.747 回答