【问题标题】:Google discovery service sending incorrect response for Gmail DiscoveryGoogle 发现服务为 Gmail 发现发送错误响应
【发布时间】:2020-07-13 10:00:57
【问题描述】:

我们使用https://github.com/googleapis/google-api-python-client 连接到Gmail,该Gmail 也处理发现。今天我们注意到 API 没有在其中一台服务器中通过,并发现发现缓存(缓存在 google-api-python-client-discovery-doc.cache 中)无效且 JSON 不可解析。

看起来发现模式构建不正确或在传输过程中丢失了某些东西(后者如何发生,我不知道) 我在此处添加了部分 JSON,您可以在此处的第 7 行看到无效的 JSON。

    "quotaUser": {
      "type": "string",
      "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.",
      "location": "query"
    },
    "upload_protocol": {
      "description": "Upload protocol for media (e.g. \"raw\", \"eapis.com/auth/gmail.settings.sharing": {
          "description": "Manage your sensitive mail settings, including who can manage your mail"
        },
        "https://www.googleapis.com/auth/gmail.modify": {
          "description": "View and modify but not delete your email"
        },
        "https://www.googleapis.com/auth/gmail.metadata": {
          "description": "View your email message metadata such as labels and headers, but not the email body"
        },
        "https://www.googleapis.com/auth/gmail.labels": {
          "description": "Manage mailbox labels"
        },
        "https://www.googleapis.com/auth/gmail.addons.current.message.metadata": {
          "description": "View your email message metadata when the add-on is running"
        },
        "https://www.googleapis.com/auth/gmail.insert": {
          "description": "Insert mail into your mailbox"
        }
      }
    }

我已在此处附上了有效和无效的完整发现文档:https://drive.google.com/drive/folders/12LWm_EKNeWenJWUeIJA8BRDrXjz27OYO?usp=sharing

请注意,当此缓存失效时,它可以正常工作并且 API 也正常。发生这种情况时格式会略有不同,那么 Gmail 是否有可能正在尝试某些东西并且这种情况偶尔会发生?

【问题讨论】:

标签: google-api gmail gmail-api service-discovery google-client


【解决方案1】:

缓存失效解决了问题(意味着 Python 直接获取文件的副本,而不是使用您的缓存)这一事实可能表明您的缓存文档中发生了损坏。似乎是它在文件系统上的存储方式的问题。

如果发现文件缓存被完全禁用,您能否重现该问题?

【讨论】:

  • 我们没有禁用发现 URL 中的缓存。我将从文件系统的角度进行调查。可能有两个进程正在尝试写入,并且内容太大而无法原子化。但是谷歌客户端库有一个锁定
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-02-28
  • 2022-08-21
  • 2015-09-19
  • 1970-01-01
  • 1970-01-01
  • 2021-04-17
  • 1970-01-01
相关资源
最近更新 更多