이 가이드는 Quick start for Python입니다.새로운 Google 도메인 게시 활동 오류
Google Apps 도메인 제어판에 액세스 할 수있는 G-Suite 계정도 만들었습니다. 내 코드 여기
는 포스트 삽입 :__author__ = '[email protected] (Joanna Smith)'
import httplib2
import pprint
from apiclient.discovery import build
from oauth2client.service_account import ServiceAccountCredentials
SERVICE_ACCOUNT_EMAIL = '[email protected]'
SERVICE_ACCOUNT_PKCS12_FILE_PATH = './ProjectTest-9179fae1c392.json'
USER_EMAIL = '[email protected]'
SCOPES = ['https://www.googleapis.com/auth/plus.me','https://www.googleapis.com/auth/plus.stream.write']
def authenticate():
print 'Authenticate the domain for %s' % USER_EMAIL
credentials = ServiceAccountCredentials.from_json_keyfile_name(
SERVICE_ACCOUNT_PKCS12_FILE_PATH, scopes=SCOPES)
delegate_credentials = credentials.create_delegated(USER_EMAIL)
http = httplib2.Http()
http = delegate_credentials.authorize(http)
return build('plusDomains', 'v1', http=http)
def activitiesInsert(service):
user_id = 'me'
print('Insert activity')
result = service.activities().insert(
userId = user_id,
body = {
'object' : {
'originalContent' : 'Happy Monday! #caseofthemondays'
}
'access' : {
'items' : [{
'type' : 'domain'
}],
'domainRestricted': True
}
}).execute()
print('result = %s' % pprint.pformat(result))
if __name__ == '__main__':
service = authenticate()
activitiesInsert(service)
내가 확인 서비스 계정 키의 "전체 도메인 G 스위트 룸에 위임을 사용"해야 된 ClientID를 검색하려면, 그리고 나 또한 클라이언트 ID에 대한 범위를 추가 한 Google Apps 도메인 제어판에서 가져 왔습니다.
하지만 내 코드 그것을 출력이 오류 실행하면
<HttpError 403 when requesting https://www.googleapis.com/plusDomains/v1/people/me/activities?alt=json returned "Forbidden">
왜?
이 양식을 구독해야합니까? https://developers.google.com/+/web/api/rest/pages-signup
편집 : 인증에 대한 스크린 샷을 완료했습니다. 나에게 잘된 것 같습니다. enter image description here
업데이트 : 내가 한 것처럼 처음으로 Google+를 구성했습니다. –