本文整理匯總了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")