1

이 가이드는 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

+0

업데이트 : 내가 한 것처럼 처음으로 Google+를 구성했습니다. –

답변

0

403 forbidden

enter image description here

enter image description here

enter image description here

은 당신이 당신이하려고하는 것입니다 무엇도 할 수있는 권한이없는 것을 의미한다. 이 경우 도메인 활동 페이지에 삽입하십시오. 먼저해야 할 일은 도메인 계정에 서비스 계정이 추가되었는지 확인하고 필요한 권한이 있는지 확인하는 것입니다. 도움이 될 것입니다. Perform Google Apps domain-wide delegation of authority

사용중인 Google+ 도메인 API임을 기억하십시오. 그러면 도메인 계정 활동 페이지에 게시됩니다. 이것은 Google+ social media website에 아무 것도 게시하지 않을 것입니다.

Google Plus pages API은 Google+ 소셜 미디어 웹 사이트의 페이지에 글쓰기를위한 것입니다. 그것은 비공개 베타 버전입니다.

+0

내 게시물을 편집했으며 일부 스크린 샷을 추가했습니다. –