我想访问我的谷歌代销商网络产品提要通过谷歌搜索API购物。我想在我正在开发的后端Python库中这样做。有人做过这样的事吗?
我有以下几点:
OAuth2 Python代码:
from apiclient.discovery import build
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.tools import run
from oauth2client.django_orm import Storage
from models import CredentialsModel
storage = Storage(CredentialsModel, 'name', 'GAN Reporting', 'credentials')
credentials = storage.get()
if credentials is None or credentials.invalid == True:
flow = OAuth2WebServerFlow(
client_id=MyClientID,
client_secret=MyClientSecret,
scope='https://www.googleapis.com/auth/shoppingapi',
user_agent='cleverblocks/1.0',
access_type='offline')
credentials = run(flow, storage)
http = httplib2.Http()
credentials.authorize(http)
client = build('shopping', 'v1', http=http,
developerKey=MyAPIKey)
resource = client.products()
request = resource.list(source='gan:MyGANPid', country='US')
return request.execute()运行此操作将得到以下错误(HttpError 412):
没有为给定的发布者注册广告商
我用于身份验证的用户列在GAN->设置->users部分。
我已经从四面八方对此进行了黑客攻击,直到现在我开始认为这个API被破坏了。有没有人能通过购物的搜索API访问GAN的产品提要?
任何帮助都是非常感谢的。
发布于 2012-04-19 13:53:47
最后,上述oAuth代码开始工作。
缺少的步骤是在GAN控制台的订阅->Product下,为所有广告商设置FTP订阅。我使用了假FTP凭据。
如果没有这个步骤,您将得到上述错误。
https://stackoverflow.com/questions/10091996
复制相似问题