I'm using this code to send Http request inside my app and then show the result:
def get(self):
url = "http://www.google.com/"
try:
result = urllib2.urlopen(url)
self.response.out.write(result)
except urllib2.URLError, e:
I expect to get the html code of google.com page, but I get this sign ">", what the wrong with that ?
Try using the urlfetch service instead of urllib2:
Import urlfetch:
And this in your request handler:
See this document for more detail.
You need to call the read() method to read the response. Also good practice to check the HTTP status, and close when your done.
Example: