Skip to content

Instantly share code, notes, and snippets.

@makenai
Created January 31, 2011 05:42
Show Gist options
  • Save makenai/803685 to your computer and use it in GitHub Desktop.
Save makenai/803685 to your computer and use it in GitHub Desktop.
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.api import urlfetch
import pprint
class MainHandler(webapp.RequestHandler):
def get(self,path):
pp = pprint.PrettyPrinter(indent=4)
request_url = 'http://api.zappos.com/' + path + '?' + self.request.query_string
response = urlfetch.fetch( request_url )
headers = pprint.pformat( response.headers )
self.response.headers['Content-Type'] = "text/plain"
self.response.out.write(
"urlfetch.fetch('" + request_url + "')" + "\n\n" +
"response.status_code: " + str( response.status_code ) + "\n\n" +
"response.headers: " + headers + "\n\n" +
"response.content:" + response.content
)
def main():
application = webapp.WSGIApplication([('/(.*)', MainHandler)],
debug=True)
util.run_wsgi_app(application)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment