当我使用 gdata-python-client 库https://github.com/google/gdata-python-client/blob/master/samples/apps/email_audit_email_monitoring.py时,我一开始就遇到了错误。
import re
import sys
import gdata
from gdata.apps.audit.service import AuditService
consumer_key = ""
consumer_secret = ""
domain = "connect-with.in"
service = AuditService(domain=domain, source='emailAuditSample')
service.SetOAuthInputParameters(gdata.auth.OAuthSignatureMethod.HMAC_SHA1, consumer_key, consumer_secret)
request_token = service.FetchOAuthRequestToken()
service.SetOAuthToken(request_token)
auth_url = service.GenerateOAuthAuthorizationURL()
print auth_url
raw_input('Manually go to the above URL and authenticate.'
'Press Return after authorization.')
service.UpgradeToOAuthAccessToken()
它总是说
in line 12 gdata.service.FetchingOAuthRequestTokenFailed: {'status': 400, 'body': 'Consumer is not registered: 138497053107-69esj3btdoq14i27qtqkuhr26vfiq65s.apps.googleusercontent.com\n\n', 'reason': 'Non 200 response on fetch request token'}
我使用了在 Google 开发者控制台中应用的客户端 ID 和客户端密码,但它不起作用。那么哪个密钥和秘密会起作用?