本文整理汇总了Python中git_handler.GitHandler.clone方法的典型用法代码示例。如果您正苦于以下问题:Python GitHandler.clone方法的具体用法?Python GitHandler.clone怎么用?Python GitHandler.clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类git_handler.GitHandler
的用法示例。
在下文中一共展示了GitHandler.clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_POST
# 需要导入模块: from git_handler import GitHandler [as 别名]
# 或者: from git_handler.GitHandler import clone [as 别名]
def do_POST(self):
""" Reply to an HTTP POST """
if not self.__authenticate():
self.send_response(403)
self.end_headers()
return
# Send response 202 Accepted
# We've accepted the request and are processing it.
self.send_response(202)
try:
post_data = json.loads(
self.rfile.read(
int(self.headers['Content-Length'])).decode('utf-8'))
if post_data['action'] not in ('opened', 'synchronize'):
# Pull Request is no longer open.
# Reply with HTTP 409 Conflict
self.send_response(409)
self.end_headers()
return
handler = GitHandler(post_data)
handler.clone()
handler.pylint_and_comment(self.config)
# Reply 201 Created, we're not using 200 OK
# because in that case we would have to send the result of
# processing as a reply.
# Instead we've created a comment on Github.
self.send_response(201)
self.end_headers()
except Exception as error:
print('Something gone wrong:\n{}'.format(str(error)))
self.send_response(500)
self.end_headers()