1

以下 python 脚本作为云函数在 GCP 服务器 us-central1 上运行,最近开始抛出 UnknownApiNameOrVersion 错误。日志显示源自下面提到的网站管理员构建功能的错误。

from googleapiclient.discovery import build
import requests
from datetime import datetime
import json
import pandas as pd
from google.cloud import bigquery
from google.cloud import secretmanager
import json

client = secretmanager.SecretManagerServiceClient()
secret = client.access_secret_version('...')

secret = json.loads(secret.payload.data.decode('UTF-8'))
credentials = service_account.Credentials.from_service_account_info(secret, scopes=SCOPES)
webmaster = build(
    'webmasters',
    'v3',
    credentials=credentials
)
4

1 回答 1

0

迟到的答案,但由于 API 更改,您应该更改您的代码:

  • 网站管理员更改为searchconsole
  • v3更改为v1

更多信息在这里

于 2022-01-27T08:55:30.293 回答