Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 99a2cbb9c3
Fetching contributors…

Cannot retrieve contributors at this time

executable file 34 lines (26 sloc) 1.021 kb
#!/usr/bin/env python
# enable debugging
import cgitb
import cgi
import urllib2
import ConfigParser
import os
form = cgi.FieldStorage()
url = urllib2.unquote(form.getfirst('url', ''))
code = form.getfirst('code', '')
config = ConfigParser.RawConfigParser()'./config')
id = config.get('github', 'app_id')
secret = config.get('github', 'app_secret')
data = {'client_id': id, 'redirect_uri': url, 'client_secret': secret, 'code': code}
req = urllib2.Request('' +
'client_id=%s&redirect_uri=%s&client_secret=%s&code=%s' %
(id, 'http://%s%s?url=%s' % (os.environ['SERVER_NAME'], os.environ['REQUEST_URI'], url), secret, code))
f = urllib2.urlopen(req)
results =
print 'Status: 303'
print 'Location: %s?%s' % (url, results)
print "Content-Type: text/html;charset=utf-8"
print "<html><body><a href=%s?%s>Click here if you're not redirected automatically</a></body></html>" % (url, results)
Jump to Line
Something went wrong with that request. Please try again.