0
我想通過Google搜索API訪問我的Google Affiliate Network產品Feed以購物。我想從我正在開發的後端Python庫中執行此操作。有沒有人做過這樣的事情?通過Google搜索API購物訪問Google Affiliate Network產品Feed
我有以下幾點:
- 一個谷歌帳戶 在谷歌API控制檯購物
- 啓用搜索API,並得到 API密鑰(用於服務器應用程序)和客戶端ID +客戶端密鑰(爲已安裝的應用程序)
- 一個GAN賬戶並獲得了pid。
- 幾位廣告客戶批准了我,因此我的產品Feed中有可用的產品。
的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):
沒有廣告商註冊了給定的發行
我用來認證的用戶列在第e GAN-> settings-> users部分。
我一直在從這個方向入侵到所有方向,現在我開始認爲這個API被破壞了。有沒有人設法通過Search API for Shopping訪問GAN產品Feed?
任何幫助表示讚賞。