Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Google App Engine Primer > Fetching URLs

Fetching URLs

One thing that should be mentioned about GAE is that there are some modules from the standard library that are not accessible because of the sensitive nature of running applications in a shared environment. Unfortunately, urllib, urllib2, and httplib are some common modules that you may have used for implementing HTTP requests that are off limits to your GAE application; however, GAE naturally provides ways to make both synchronous and asynchronous requests in a familiar enough manner. Example 1-3 is an updated version of Example 1-2 that makes use of the urlfetch function to perform a synchronous HTTP request. (Asynchronous requests are made in a very similar manner except that a callback function defines what should happen once the request completes.) Note the use of the keyword parameter validate_certificate, which is employed to ensure that the request is securely completed so as to avoid potential man-in-the-middle attacks. You should be able to deploy the application and verify that it can indeed securely fetch the URL https://paypal.com/ before continuing.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial