Facebook 工作场所合规性集成 - 错误代码 960

Facebook Workplace Compliance Integration - Error code 960

我正在使用 Python 和 Facebook Graph API 编写合规性集成,以在我们的 Workplace 社区中搜索给定关键字的所有用户内容。我有一些以前每次都有效的东西,但是最近(在过去的几天里)发送到 Facebook 的请求之一将 return 一个 FacebookApiException 错误代码 960 和一条消息 "Request aborted. This could happen if a dependent request failed or the entire request timed out." 在已经成功收到数以千计的成功请求。这种情况不会一直发生,但通常会失败。

{
  "error": {
    "message": "Request aborted. This could happen if a dependent request failed or the entire request timed out.",
    "code": 960,
    "type": "FacebookApiException",
    "fbtrace_id": "B72L8jiCFZy"
  }
}

为了简单起见,我没有在我的请求中使用依赖项,所以我只能认为它超时了。我的问题是——Facebook Graph API 的超时期限是多少?超时是因为我发送请求的时间太长,还是因为 Facebook 服务器响应我的请求的时间太长?有什么办法可以增加超时来阻止错误消息的发生?

TIA

这个问题比较老,但以防其他人正在寻找答案。

我无法回答 Facebook Graph Api 的超时期限是多少,但我可以为那些 运行 遇到超时错误的人指出一个解决方法。

Facebook 有关于如何处理超时的文档: https://developers.facebook.com/docs/graph-api/making-multiple-requests/#timeouts

Large or complex batches may timeout if it takes too long to complete all the requests within the batch. In such a circumstance, the result is a partially-completed batch. In partially-completed batches, responses from operations that complete successfully will look normal (see prior examples) whereas responses for operations that are not completed will be null.

The ordering of responses correspond with the ordering of operations in the request, so developers should process responses accordingly to determine which operations were successful and which should be retried in a subsequent operation.

因此,根据他们的文档,超时的批处理请求的响应应如下所示:

[
    { "code": 200,
      "headers": [
          { "name":"Content-Type", 
            "value":"text/javascript; charset=UTF-8"}
       ],
      "body":"{\"id\":\"…\"}"
    },
    null,null,null
]

使用他们的示例,您应该只需要 re-queue 批处理请求数组中与空响应对应的项目。