From 5cf7c9c0f74df3b856f6bdd573e8e02660c18262 Mon Sep 17 00:00:00 2001 From: Joe Gregorio Date: Thu, 20 Oct 2011 13:34:23 -0400 Subject: Fixes issue 161. Don't use App Engine urlfetch when the apiproxy stub is not present. Reviewed in http://codereview.appspot.com/4823050/. --- python2/httplib2/__init__.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'python2') diff --git a/python2/httplib2/__init__.py b/python2/httplib2/__init__.py index bbf6f79..334177e 100644 --- a/python2/httplib2/__init__.py +++ b/python2/httplib2/__init__.py @@ -934,6 +934,9 @@ SCHEME_TO_CONNECTION = { # Use a different connection object for Google App Engine try: + from google.appengine.api import apiproxy_stub_map + if apiproxy_stub_map.apiproxy.GetStub('urlfetch') is None: + raise ImportError # Bail out; we're not actually running on App Engine. from google.appengine.api.urlfetch import fetch from google.appengine.api.urlfetch import InvalidURLError from google.appengine.api.urlfetch import DownloadError -- cgit v1.2.1