summaryrefslogtreecommitdiff
path: root/python2/httplib2
diff options
context:
space:
mode:
authorJoe Gregorio <jcgregorio@google.com>2011-10-20 13:34:23 -0400
committerJoe Gregorio <jcgregorio@google.com>2011-10-20 13:34:23 -0400
commit5cf7c9c0f74df3b856f6bdd573e8e02660c18262 (patch)
tree4c9da655f9599cef1037ed12754ccb4db896e68a /python2/httplib2
parente428f07824d66a6aeaaa072a6fc896d32194cc75 (diff)
downloadhttplib2-5cf7c9c0f74df3b856f6bdd573e8e02660c18262.tar.gz
Fixes issue 161.
Don't use App Engine urlfetch when the apiproxy stub is not present. Reviewed in http://codereview.appspot.com/4823050/.
Diffstat (limited to 'python2/httplib2')
-rw-r--r--python2/httplib2/__init__.py3
1 files changed, 3 insertions, 0 deletions
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