이 자습서의 내용은 Using OAuth 2.0 for Server to Server Applications입니다. 서비스 계정을 사용하여 Gmail API에 연결하려고합니다.서버 응용 프로그램에 대한 Gmail API 서버 (잘못된 요청 오류)
이 같은 외모와 끝까지 코드 :이 코드를 실행하면
from oauth2client.service_account import ServiceAccountCredentials
from httplib2 import Http
from apiclient.discovery import build
import json
scopes = ['https://www.googleapis.com/auth/gmail.readonly']
credentials = ServiceAccountCredentials.from_json_keyfile_name('******.json', scopes)
http_auth = credentials.authorize(Http())
service = build('gmail', 'v1', http=http_auth)
request = service.users().messages().list(userId='me')
response = request.execute()
print json.dumps(response, sort_keys=True, indent=2)
그러나, 나는 다음과 같은 오류 얻을 :
googleapiclient.errors.HttpError:https://www.googleapis.com/gmail/v1/users/me/messages?alt=json returned "Bad Request">
누군가가 나를 도울 수
이해를 경우이 오류 오는거야?