1

Google API Python客戶端(http://code.google.com/p/google-api-python-client/)有一個示例應用程序,演示了Google App Engine基礎結構上的OAUTH2。這可以在這裏找到:Google API Python客戶端OAUTH Appengine示例borked?

http://code.google.com/p/google-api-python-client/source/browse/#hg%2Fsamples%2Fappengine

我試圖抓住這個例子中,在我的應用程序的憑據的client_secrets.json填充,但與當地dev_appserver運行我得到:

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 <module> 
    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 <module> 
    _ssl_wrap_socket = ssl.wrap_socket 
AttributeError: 'module' object has no attribute 'wrap_socket' 

當我部署應用程序使用appcfg.py住在GAE上,當我前往我的應用程序的根頁面,我得到一個500服務器錯誤,並發展控制檯日誌閱讀:

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 <module> 
    from oauth2client.appengine import oauth2decorator_from_clientsecrets 
    File "/base/data/home/apps/s~pzelnip/1.356864969797552635/oauth2client/appengine.py", line 40, in <module> 
    from client import AccessTokenRefreshError 
    File "/base/data/home/apps/s~pzelnip/1.356864969797552635/oauth2client/client.py", line 63, in <module> 
    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' 

那麼,呃,幫忙?

FWIW,我也跟着在整個客戶端代碼複製到應用程序引擎項目(截至http://code.google.com/p/google-api-python-client/wiki/GoogleAppEngine概述)的說明

回答