在github中webhook中添加自己的回调接口然后处理github发过来的请求python代码如下:
import web
from subprocess import call
path = '/home/wwwroot/default/testsmirk.github.io'
git_path = 'https://github.com/TestSmirk/testsmirk.github.io.git'
urls = (
'/(.*)', 'hello'
)
app = web.application(urls, globals())
class hello:
def POST(self, name):
call(['cd "' + path + '" && git pull '+git_path], shell=True)
if __name__ == "__main__":
app.run()
© 著作权归作者所有
文章评论(0)