title: Google API Python Client OAUTH Appengine example borked?
body: <p>The Google API Python client (<a href="http://code.google.com/p/google-api-python-client/" rel="nofollow">http://code.google.com/p/google-api-python-client/</a>) has a sample application demonstrating OAUTH2 on the Google App Engine infrastructure.  This can be found at:</p>
  
  <p><a href="http://code.google.com/p/google-api-python-client/source/browse/#hg%2Fsamples%2Fappengine" rel="nofollow">http://code.google.com/p/google-api-python-client/source/browse/#hg%2Fsamples%2Fappengine</a></p>
  
  <p>I tried grabbing this example, filling in the client_secrets.json with my app's credentials, but running with the local dev_appserver I get:</p>
  
  <pre><code>WARNING  2012-02-16 20:52:45,650 rdbms_mysqldb.py:94] The rdbms API is not available because the MySQLdb library could not be loaded.
  INFO     2012-02-16 20:52:45,729 appengine_rpc.py:159] Server: appengine.google.com
  INFO     2012-02-16 20:52:45,731 appcfg.py:561] Checking for updates to the SDK.
  INFO     2012-02-16 20:52:46,008 appcfg.py:579] The SDK is up to date.
  WARNING  2012-02-16 20:52:46,009 datastore_file_stub.py:512] Could not read datastore data from /tmp/dev_appserver.datastore
  INFO     2012-02-16 20:52:46,036 dev_appserver_multiprocess.py:639] Running application dev~pzelnip on port 8080: http://localhost:8080
  INFO     2012-02-16 20:52:46,036 dev_appserver_multiprocess.py:641] Admin console is available at: http://localhost:8080/_ah/admin
  ERROR    2012-02-16 20:52:48,921 cgi.py:121] Traceback (most recent call last):
    File "/home/aparkin/temp/gae_oauth_demo/google-api-python-client/samples/appengine/main.py", line 28, in &lt;module&gt;
      import httplib2
    File "/home/aparkin/Downloads/gae_newer/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 676, in Decorate
      return func(self, *args, **kwargs)
    File "/home/aparkin/Downloads/gae_newer/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1845, in load_module
      return self.FindAndLoadModule(submodule, fullname, search_path)
    File "/home/aparkin/Downloads/gae_newer/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 676, in Decorate
      return func(self, *args, **kwargs)
    File "/home/aparkin/Downloads/gae_newer/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1717, in FindAndLoadModule
      description)
    File "/home/aparkin/Downloads/gae_newer/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 676, in Decorate
      return func(self, *args, **kwargs)
    File "/home/aparkin/Downloads/gae_newer/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1660, in LoadModuleRestricted
      description)
    File "/home/aparkin/temp/gae_oauth_demo/google-api-python-client/samples/appengine/httplib2/__init__.py", line 64, in &lt;module&gt;
      _ssl_wrap_socket = ssl.wrap_socket
  AttributeError: 'module' object has no attribute 'wrap_socket'
  </code></pre>
  
  <p>When I deploy the app live on GAE using appcfg.py, when I head to the root page of my app, I get a 500 Server Error, and the development console logs read:</p>
  
  <pre><code>2012-02-16 12:53:59.271 / 500 1079ms 0kb Mozilla/5.0 (Ubuntu; X11; Linux x86_64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1
  
  64.251.74.12 - - [16/Feb/2012:12:53:59 -0800] "GET / HTTP/1.1" 500 0 - "Mozilla/5.0 (Ubuntu; X11; Linux x86_64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1" "pzelnip.appspot.com" ms=1079 cpu_ms=373 api_cpu_ms=0 cpm_usd=0.010403 loading_request=1 instance=00c61b117c31344046c8b30771918918ee8d
  
  E 2012-02-16 12:53:59.269
  
  Traceback (most recent call last):
    File "/base/data/home/apps/s~pzelnip/1.356864969797552635/main.py", line 34, in &lt;module&gt;
      from oauth2client.appengine import oauth2decorator_from_clientsecrets
    File "/base/data/home/apps/s~pzelnip/1.356864969797552635/oauth2client/appengine.py", line 40, in &lt;module&gt;
      from client import AccessTokenRefreshError
    File "/base/data/home/apps/s~pzelnip/1.356864969797552635/oauth2client/client.py", line 63, in &lt;module&gt;
      CACHED_HTTP = httplib2.Http('.cache')
    File "/base/data/home/apps/s~pzelnip/1.356864969797552635/httplib2/__init__.py", line 803, in __init__
      self.cache = FileCache(cache)
    File "/base/data/home/apps/s~pzelnip/1.356864969797552635/httplib2/__init__.py", line 649, in __init__
      os.makedirs(self.cache)
    File "/base/python27_runtime/python27_dist/lib/python2.7/os.py", line 157, in makedirs
      mkdir(name, mode)
  OSError: [Errno 38] Function not implemented: '.cache'
  </code></pre>
  
  <p>So uhm, help?</p>
  
  <p>FWIW, I did follow the instructions on copying the entire client code to the app engine project (as outlined at <a href="http://code.google.com/p/google-api-python-client/wiki/GoogleAppEngine" rel="nofollow">http://code.google.com/p/google-api-python-client/wiki/GoogleAppEngine</a>)</p>