无法访问webmasters.dat:没有此类文件或目录

时间:2020-05-24 10:52:24

标签: google-api google-oauth google-api-python-client google-search-api google-apis-explorer

我正在尝试访问Google Search Console API-尝试了示例[https://github.com/googleapis/google-api-python-client/blob/master/samples/searchconsole/search_analytics_api_sample.py][1]

我按照说明进行操作:

1)安装Google Python客户端库,如下所示 https://developers.google.com/webmaster-tools/v3/libraries。 2)在Google API控制台中注册一个新项目,网址为 https://code.google.com/apis/console。 3)注册要使用的项目 适用于已安装应用程序的OAuth2.0。 4)复制您的客户ID,客户 机密,然后将URL重定向到包含在其中的client_secrets.json文件中 这个包。 5)如下所示,在命令行中运行该应用程序。 用法示例:$ python search_analytics_api_sample.py 'https://www.example.com/''2015-05-01''2015-05-30'

当然是我的网站和较新的日期。

在cmd中收到警告:

\ AppData \ Local \ Programs \ Python \ Python38 \ lib \ site-packages \ oauth2client_helpers.py:255: UserWarning:无法访问webmasters.dat:没有此类文件或目录

在浏览器中打开的窗口中

收到消息:

错误400:redirect_uri_mismatch请求中的重定向URI, http://localhost:8080/,与授权给 OAuth客户端。要更新授权的重定向URI,请访问: https://console.developers.google.com/apis/credentials/oauthclient/xxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com?project=xxxxxxxxxxxx

我将重定向URI配置为http://localhost:8080/,但仍然相同

感谢任何帮助

0 个答案:

没有答案