pwsm / httplib2

Automatically exported from code.google.com/p/httplib2
0 stars 0 forks source link

httplib2 unusable when App Engine SDK present on PYTHONPATH, but not running in an appserver context #161

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Download and extract Python App Engine SDK
2. Put the SDK folder on PYTHONPATH
3. Run a Python script which attempts to use httplib2

What is the expected output? What do you see instead?

Any attempts to fetch a URL with httplib2 will fail with:
AssertionError: No api proxy found for service "urlfetch"

Since the application is not actually running on dev_appserver.py or prod GAE, 
the API Proxy stub for urlfetch has not been setup, and the fetch attempt will 
fail.

I think the selection logic for choosing when to use the App Engine urlfetch 
api is a bit too aggressive.  Instead of basing the decision entirely on 
whether the SDK modules can be imported, it might be better to add a 
conditional check to ensure that the 'urlfetch' stub is actually present in the 
apiproxy_stub_map:

from google.appengine.api import apiproxy_stub_map
if apiproxy_stub_map.apiproxy.GetStub('urlfetch') is None:
  # Don't use urlfetch since we're not actually running on App Engine.

Original issue reported on code.google.com by mmcdon...@google.com on 26 Jul 2011 at 4:43

GoogleCodeExporter commented 8 years ago
the same, i have remove the gae path from pythonpath

Original comment by skxiao...@gmail.com on 5 Aug 2011 at 6:59

GoogleCodeExporter commented 8 years ago
Patch mailed for a review: http://codereview.appspot.com/4823050/

Original comment by mmcdon...@google.com on 5 Aug 2011 at 3:37

GoogleCodeExporter commented 8 years ago
This issue was closed by revision d36795715330.

Original comment by joe.gregorio@gmail.com on 20 Oct 2011 at 5:34