0

最近、アプリによって Google ドライブ アカウントにアップロードされたファイルと、元のファイルのサイズを変更して作成された新しいファイルに対して、次の 4 つの手順を実行する Google App Engine タスクがタスク キューにあります。

1- file = service.files().get(fileId=googleDriveFileId).execute()

2- resizedImage = resizeImage(theImage,currentWidth,currentHeight,135,90);
   newImage = putGoogleDriveFile(user,resizedImage,imageName,'image/jpeg',None,"image")

3- service.permissions().insert(fileId=file_id, body=new_permission).execute()

4- service.files().delete(fileId=googleDriveFileId).execute()

すべての手順が機能し、すべてのファイルが適切な権限を持つはずの場所にあるなどです。

ただし、ログ ファイルには、各ステップで access_token が更新されていることが示されています。

 URL being requested: https://www.googleapis.com/discovery/v1/apis/drive/v2/rest?userIp=0.1.0.2
2012-09-01 07:51:10.578 URL being requested: https://www.googleapis.com/drive/v2/files/0Bx4nwQIkoY_7OVE4U3JtcUVPMzQ?alt=json
2012-09-01 07:51:10.602 Refreshing due to a 401
2012-09-01 07:51:10.602 Refresing access_token
2012-09-01 07:51:11.222 putting drive file
2012-09-01 07:51:11.231 have credentials
2012-09-01 07:51:11.232 URL being requested:  https://www.googleapis.com/discovery/v1/apis/drive/v2/rest?userIp=0.1.0.2
2012-09-01 07:51:11.478 URL being requested: https://www.googleapis.com/upload/drive/v2/files?uploadType=multipart&alt=json
2012-09-01 07:51:11.505 Refreshing due to a 401
2012-09-01 07:51:11.505 Refresing access_token
2012-09-01 07:51:13.676 setting permissions
2012-09-01 07:51:13.682 have credentials
2012-09-01 07:51:13.684 URL being requested: https://www.googleapis.com/discovery/v1/apis/drive/v2/rest?userIp=0.1.0.2
2012-09-01 07:51:13.777 URL being requested: https://www.googleapis.com/drive/v2/files/0Bx4nwQIkoY_7dXhUbWdLaU9feUU/permissions?alt=json
2012-09-01 07:51:13.803 Refreshing due to a 401
2012-09-01 07:51:13.803 Refresing access_token
2012-09-01 07:51:14.484 have credentials
2012-09-01 07:51:14.485 URL being requested: https://www.googleapis.com/discovery/v1/apis/drive/v2/rest?userIp=0.1.0.2
2012-09-01 07:51:14.656 URL being requested: https://www.googleapis.com/drive/v2/files/0Bx4nwQIkoY_7UUJadzNGa2oxRjA
2012-09-01 07:51:15.098 Refreshing due to a 401
2012-09-01 07:51:15.098 Refresing access_token

これは私が期待すべきことですか?1 つのループで実行される 4 つのアクションに対して 1 つの access_token で十分であるように思えます。

ありがとう、クリス

4

1 に答える 1

1

通常のaccess_tokenは1時間続きます。私の推測では、各リクエストは、光沢のある新しいトークンではなく、期限切れのトークンをまだ使用しています。

于 2012-09-01T16:19:48.730 に答える