Skip to content

Instantly share code, notes, and snippets.

@jugglinmike
Created July 2, 2012 18:35
Show Gist options
  • Save jugglinmike/3034792 to your computer and use it in GitHub Desktop.
Save jugglinmike/3034792 to your computer and use it in GitHub Desktop.
Sandbox Post-receive Handler
from flask import Flask
from flask import request
import git
import json
app = Flask(__name__)
@app.route("/")
def hello_world():
return "Hello, world!"
@app.route("/postreceive", methods=["POST"])
def update_repo():
repo_name = json.loads(request.form["payload"])["repository"]["name"]
repo = git.Repo("../" + repo_name)
repo.remotes.origin.pull()
return "Success"
if __name__ == "__main__":
app.debug = True
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment