我正在尝试通过Google API读取客户的提要。我有一个访问令牌
这是我遵循的文档:https://developers.google.com/shopping-content/developers-guide-python#authentication
这里的例子显示了一个ACCOUNT_ID使用,但我不明白在哪里接收这个信息。
import gdata.contentforshopping.client
ACCOUNT_ID = '1234567'
shopping_client = gdata.contentforshopping.client.ContentForShoppingClient(account_id=ACCOUNT_ID)
到目前为止我所做的是:
import gdata.contentforshopping.client
import gdata.gauth
part = 2
auth_token = gdata.gauth.OAuth2Token(client_id=CLIENT_ID, client_secret=CLIENT_SECRET, scope=SCOPE, user_agent=USER_AGENT)
shopping_client = gdata.contentforshopping.client.ContentForShoppingClient()
authorize_url = auth_token.generate_authorize_url(redirect_uri=APPLICATION_REDIRECT_URI)
if part == 1:
print 'Please visit: %s' % authorize_url
elif part == 2:
query = {'code': 'xxxx'} # received from result of part == 1
auth_token.get_access_token(query)
auth_token.authorize(shopping_client)
accounts = shopping_client.GetClientAccounts()
print(accounts)
事实证明,没有合适的方法来做到这一点。您必须从旧API中获得错误并解析它以找出您的商家id。
来源:https://groups.google.com/forum/!主题/google-content-api-for-shopping/3 ilem9pujis