Skip to content

Instantly share code, notes, and snippets.

@sadovnychyi
Created September 26, 2012 14:31
Show Gist options
  • Save sadovnychyi/3788386 to your computer and use it in GitHub Desktop.
Save sadovnychyi/3788386 to your computer and use it in GitHub Desktop.
Autodeploy go GAE via EXO-IDE
# -*- coding: utf-8 -*-
import webapp2
import base64
from google.appengine.api import urlfetch
class Deploy(webapp2.RequestHandler):
def post(self):
domain = self.request.get('domain') or 'appengine'
project_id = self.request.get('project_id')
user = self.request.get('user')
password = self.request.get('password')
vfsid = 'dev-monit'
urlfetch.fetch(url='http://%s.cloud-ide.com/shell/rest/private/ide/git/pull?vfsid=%s&projectid=%s' % (domain, vfsid, project_id),
method=urlfetch.POST,
payload='{"refSpec":"refs/heads/master:refs/remotes/origin/master", "remote":"origin"}',
deadline=60,
headers={'Authorization': 'Basic ' + base64.b64encode('%s:%s' % (user, password)), "Content-Type": "application/json"})
result = urlfetch.fetch(url='http://%s.cloud-ide.com/shell/rest/private/ide/appengine/update?vfsid=%s&projectid=%s&async=true' % (domain, vfsid, project_id),
method=urlfetch.GET,
deadline=60,
headers={'Authorization': 'Basic ' + base64.b64encode('%s:%s' % (user, password))})
return self.response.write(result.content)
application = webapp2.WSGIApplication([
(r'/deploy', Deploy),
], debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment