本文整理汇总了Python中github.GitHub.createIssue方法的典型用法代码示例。如果您正苦于以下问题:Python GitHub.createIssue方法的具体用法?Python GitHub.createIssue怎么用?Python GitHub.createIssue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.GitHub
的用法示例。
在下文中一共展示了GitHub.createIssue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from github import GitHub [as 别名]
# 或者: from github.GitHub import createIssue [as 别名]
def post(self):
try:
message = {
'title': self.request.POST['title'],
'user': self.request.POST['user'],
'browser': self.request.POST['browser'],
'message': self.request.POST['message'],
'version': self.request.POST['version'],
}
except KeyError as err:
self.response.status = 400
self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
self.response.write('Missing Key: "%s"'%err.message)
return
if not message['title']:
self.response.status = 400
self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
self.response.write('Der Titel der Fehlermeldung wurde nicht angegeben')
return
if not message['message']:
self.response.status = 400
self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
self.response.write('Die Beschreibung der Fehlermeldung wurde nicht angegeben')
return
# savedata: data from the save button
try:
savedata = self.request.POST['save']
savefilename = savedata.filename
savedata = savedata.file.read()
except:
savefilename = None
savedata = None
try:
ghcreds = get_githubcredentials()
except:
self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
self.response.write('Missing Key: "%s"'%err.message)
return
gh = GitHub(ghcreds.owner, ghcreds.repo, ghcreds.token)
url = ''
try:
url = gh.createIssue(message, savedata, savefilename)
except:
pass
if url:
# everything's fine
# self.response.status = 201
# self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
# self.response.write(url)
self.redirect(url.encode('ascii', 'ignore'))
else:
self.response.status = 500
self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
self.response.write("Server Error: cannot create issue. This might be caused by missing or invalid values")