Python google 索引导致问题。给我错误“latestUpdate”

问题描述 投票:0回答:1

当我尝试使用 Python 命令将网址提交到 Google 搜索控制台时,出现此错误

python3 GoogleIndexing.py

这是我得到的错误,我不确定为什么会这样做。

Traceback (most recent call last):


File "/Users/mihiran/Documents/Fiveup/indexing/GoogleIndexing.py", line 46, in <module>
    csv[["URL"]].apply(lambda x: indexURL(x, http))
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pandas/core/frame.py", line 10374, in apply
    return op.apply().__finalize__(self, method="apply")
           ^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pandas/core/apply.py", line 916, in apply
    return self.apply_standard()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pandas/core/apply.py", line 1063, in apply_standard
    results, res_index = self.apply_series_generator()
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pandas/core/apply.py", line 1081, in apply_series_generator
    results[i] = self.func(v, *self.args, **self.kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mihiran/Documents/Fiveup/indexing/GoogleIndexing.py", line 46, in <lambda>
    csv[["URL"]].apply(lambda x: indexURL(x, http))
                                 ^^^^^^^^^^^^^^^^^
  File "/Users/mihiran/Documents/Fiveup/indexing/GoogleIndexing.py", line 37, in indexURL
    print("urlNotificationMetadata.latestUpdate.url: {}".format(result["urlNotificationMetadata"]["latestUpdate"]["url"]))
                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'latestUpdate'
python python-3.x google-search google-index
1个回答
0
投票

关键结果[“urlNotificationMetadata”][“latestUpdate”][“url”] -->latestUpdate 丢失或具有不同的名称

© www.soinside.com 2019 - 2024. All rights reserved.