I am intermittently getting this error when calling build on a drive service. I am able to reproduce this with a simple program which has the JSON credentials stored to a file.
#!/usr/bin/python
import httplib2
import sys
from apiclient.discovery import build
from oauth2client.client import Credentials
json_creds = open('creds.txt', 'r').read()
creds = Credentials.new_from_json(json_creds)
http = httplib2.Http()
http = creds.authorize(http)
try:
drive_service = build('drive', 'v2', http=http)
except Exception:
sys.exit(-1)
When I run this in a loop, I am seeing a rather high number of errors, this code in a loop fails 15-25% of the time for me.
i=0; while [ $i -lt 100 ]; do python jsoncred.py || echo FAIL ; i=$(( $i + 1 )); done | grep FAIL | wc -l
Now when I take this same code, and just replace 'drive' by 'oauth2', the code runs without problems
I have confirmed that the OAuth token that I am using is valid and have the correct scopes:
"expires_in": 2258,
"scope": "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/userinfo.email",
Looking at my app logs, this seems to have started 2/14/2013 1PM PST. I did not push any new code, so I wonder if this a problem with the API. Is there a bug in the API causing this ?