【问题标题】:Use google plus api to insert activity in page使用 google plus api 在页面中插入活动
【发布时间】:2014-02-04 10:54:13
【问题描述】:

我需要从我的网站管理屏幕发布到我的页面流。使用Google Plus API 我希望能够添加活动并在我的页面流上共享 URL。然而,正在发生的事情是该帖子出现在我的个人资料页面上,而不是在此个人资料下创建的页面上。下面是我在 Python 中的代码的 sn-p。我尝试使用page_id 而不是“我”,但它给了我一个错误的凭据。我会很感激这方面的帮助,因为我被困住了,在过去的 5 天里一直在尝试不同的事情,但没有任何效果。

OAuth2 成功后,我执行以下操作:

http = httplib2.Http()
http = credentials.authorize(http)

service_plus = build('plus', 'v1', http=http)
service_plus_domain = build('plusDomains', 'v1', http=http)


activity = {
    'object': {
        'url': 'https://developers.google.com/+/web/snippet/examples/photo',
    },
    'access': {
       'items': [{
           'type': 'public'
       }],
       'domainRestricted': True
    }
 }

google_request = service_plus_domain.activities().insert(
    userId='me',  #Trying page_id here gives invalid credentials
    body=activity
)

result = google_request.execute()
print result

【问题讨论】:

  • 欢迎来到 StackOverflow!我无能为力,但我相信人们想知道您的错误凭据的确切错误。
  • 您确定您已获得所有必要的scopes 授权吗?您是否获得了您要发布的个人资料的用户的访问令牌?您可能需要使用service account flow 来获取这些信息。

标签: python api google-plus


【解决方案1】:

Plus API 和 Plus Domains API 都不允许您发布到页面。 Domains API 仅允许您以用户个人资料的形式发布,并且只能以某些有限的方式发布。

要发布到页面,您需要使用Plus Page API(仅限选定的合作伙伴)或与有权访问的合作伙伴之一合作,例如 HootSuite。

【讨论】:

  • 谢谢,我认为这是有限的,但我认为我做错了什么,就像我在 Facebook 上做的一样。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-12-27
  • 1970-01-01
  • 2013-01-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多