2012-04-28 7 views
2

私はDrEditのPython版を(GAEで)オンライン化しようとしています。 drive.google.comから使用された場合エラー500 GoogleドライブAPIのDrEdit Pythonの例を使用

今では正常に動作しますが、.appspot.comがアドレスからアクセスして生成します。

私は追加
Traceback (most recent call last): 
    File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 701, in __call__ 
    handler.get(*groups) 
    File "/base/data/home/apps/s~driveedit/1.358524704843584683/main.py", line 282, in get 
    drive_state = DriveState.FromRequest(self.request) 
    File "/base/data/home/apps/s~driveedit/1.358524704843584683/main.py", line 120, in FromRequest 
    return DriveState(request.get('state')) 
    File "/base/data/home/apps/s~driveedit/1.358524704843584683/main.py", line 106, in __init__ 
    state_data = json.loads(state) 
    File "/base/python_runtime/python_lib/versions/1/simplejson/__init__.py", line 388, in loads 
    return _default_decoder.decode(s) 
    File "/base/python_runtime/python_lib/versions/1/simplejson/decoder.py", line 402, in decode 
    obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 
    File "/base/python_runtime/python_lib/versions/1/simplejson/decoder.py", line 420, in raw_decode 
    raise JSONDecodeError("No JSON object could be decoded", s, idx) 
JSONDecodeError: No JSON object could be decoded: line 1 column 0 (char 0) 

「印刷request.getを( 『状態』)」 FromRequest関数では、

Status: 500 Internal Server Error Content-Type: text/html; charset=utf-8 Cache-Control: no-cache Set-Cookie: userid=MTE2MDU1NTY3NjYxNTUzNzA2MTg2|1335608904|67eb86b0a74414014c05c4085832522f16f322f1; expires=Mon, 28 May 2012 10:28:24 GMT; Path=/ Expires: Fri, 01 Jan 1990 00:00:00 GMT Content-Length: 1206 

この問題を解決するにはどうすればよいですか?

答えて

1

あなたはそうのように、これを処理するためにDriveStateを変更する必要があります。

class DriveState(object): 
    """Store state provided by Drive.""" 

    def __init__(self, state): 
    """Create a new instance of drive state. 

    Parse and load the JSON state parameter. 

    Args: 
     state: State query parameter as a string. 
    """ 
    if state: 
     state_data = json.loads(state) 
     self.action = state_data['action'] 
     self.ids = map(str, state_data.get('ids', [])) 
    else: 
     self.action = 'create' 
     self.ids = [] 

私はこれを反映するために、サンプルコードを更新します。

編集:http://code.google.com/p/google-drive-sdk-samples/source/detail?r=53dfd57c6044394670ef0c14f1f0bb6652d87b14

で更新されました。
関連する問題