Created
January 31, 2011 05:42
-
-
Save makenai/803685 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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