Google 工作表 API HttpError 500 和 503
Google Sheets API HttpError 500 and 503
编辑:已解决,问题出在 Google 方面。在请求 sheet 时发生,其中包含包含无效间隔的图表。向 Google 报告错误。
注意:此问题已持续超过 2 天。我之前有过,等了一天后自动解决了。它已经复活了。
我目前正在通过 Google 的 python api 客户端使用 Google 表格 API。身份验证是 OAuth2.0,我没有更改我的代码库中的任何重要内容,但突然间我得到了 100% 的错误率,而且它似乎应该在 Google 结束。我担心我被无限期禁止使用 API,是这样吗?我的猜测是,当我启动脚本并立即使用 ctrl+c 取消它时,因为我想 运行 它的新版本导致了一些问题。
我尝试创建另一个项目并使用其凭据发出请求,但遇到了同样的错误。尝试让我的朋友 运行 通过他的 google 帐户验证脚本,但他收到了同样的错误。独立source code can be found here
关于源代码:get_credentials()(以及身份验证)完全从 Google 的 python 快速启动脚本复制而来 https://developers.google.com/sheets/quickstart/python .
回溯:
Traceback (most recent call last):
File "Google_sheets.py", line 164, in <module>
ss=Spreadsheet(SPREADSHEET_ID)
File "Google_sheets.py", line 83, in __init__
spreadsheetId=self.ssId, includeGridData=True).execute()['sheets']}
File "C:\Users\Larsson\AppData\Local\Programs\Python\Python35-32\lib\site-packages\oauth2client\util.py", line 137, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Users\Larsson\AppData\Local\Programs\Python\Python35-32\lib\site-packages\googleapiclient\http.py", line 838, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 500 when requesting https://sheets.googleapis.com/v4/spreadsheets/12YdppOoZUNZxhXvcY_cRgfXEfRnR_izlBsF8Sin3rw4?alt=json&includeGridData=true returned "Internal error encountered.">
不久后重试,我又收到另一个错误:
Traceback (most recent call last):
File "Google_sheets.py", line 164, in <module>
ss=Spreadsheet(SPREADSHEET_ID)
File "Google_sheets.py", line 83, in __init__
spreadsheetId=self.ssId, includeGridData=True).execute()['sheets']}
File "C:\Users\Larsson\AppData\Local\Programs\Python\Python35-32\lib\site-packages\oauth2client\util.py", line 137, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Users\Larsson\AppData\Local\Programs\Python\Python35-32\lib\site-packages\googleapiclient\http.py", line 838, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 503 when requesting https://sheets.googleapis.com/v4/spreadsheets/12YdppOoZUNZxhXvcY_cRgfXEfRnR_izlBsF8Sin3rw4?includeGridData=true&alt=json returned "The service is currently unavailable.">
500 和 503 是 Google 服务器问题。您将需要实施指数退避,以便您可以再次重试交易。检查此 link - https://developers.google.com/admin-sdk/directory/v1/limits
而且,所有 API 都有使用限制。看看这个 link - https://developers.google.com/gmail/api/v1/reference/quota
如 Standard Error Responses 中所述,错误代码 #500 和 #503 是与服务器相关的错误。建议的操作是不要多次重试查询。
要处理这些错误代码:
A 500 or 503 error might result during heavy load or for larger more complex requests. For larger requests consider requesting data for a shorter time period. Also consider implementing exponential backoff.
如果大量请求或繁重的网络流量导致服务器出现 return 错误,指数退避可能是处理这些错误的好策略。
除此之外,您还应该检查您的申请是否超过 usage limits。如果是这样,则可能应该优化您的应用程序代码以发出更少的请求。如果需要,您可以在项目的“配额”选项卡下的 Google API 控制台中选择请求额外的配额。
已解决,问题出在Google这边。在请求 sheet 时发生,其中包含包含 invalid/unselected 间隔的图表。向 Google 报告错误。
通过将所有无效图表更改为有效范围来修复。
我也遇到了这个错误,经过一些摆弄后,我发现它与我的下拉框上的数据验证有关。重新编辑您的验证,select 相同的单元格并重新保存、冲洗并重复所有此类字段,它应该可以工作。
PS:鉴于这似乎会影响其他类型的数据,我建议您删除文档的某些部分,直到它开始在脚本端工作,这样您的最后一个操作就会指出哪些单元格有问题。
编辑:已解决,问题出在 Google 方面。在请求 sheet 时发生,其中包含包含无效间隔的图表。向 Google 报告错误。
注意:此问题已持续超过 2 天。我之前有过,等了一天后自动解决了。它已经复活了。
我目前正在通过 Google 的 python api 客户端使用 Google 表格 API。身份验证是 OAuth2.0,我没有更改我的代码库中的任何重要内容,但突然间我得到了 100% 的错误率,而且它似乎应该在 Google 结束。我担心我被无限期禁止使用 API,是这样吗?我的猜测是,当我启动脚本并立即使用 ctrl+c 取消它时,因为我想 运行 它的新版本导致了一些问题。
我尝试创建另一个项目并使用其凭据发出请求,但遇到了同样的错误。尝试让我的朋友 运行 通过他的 google 帐户验证脚本,但他收到了同样的错误。独立source code can be found here
关于源代码:get_credentials()(以及身份验证)完全从 Google 的 python 快速启动脚本复制而来 https://developers.google.com/sheets/quickstart/python .
回溯:
Traceback (most recent call last):
File "Google_sheets.py", line 164, in <module>
ss=Spreadsheet(SPREADSHEET_ID)
File "Google_sheets.py", line 83, in __init__
spreadsheetId=self.ssId, includeGridData=True).execute()['sheets']}
File "C:\Users\Larsson\AppData\Local\Programs\Python\Python35-32\lib\site-packages\oauth2client\util.py", line 137, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Users\Larsson\AppData\Local\Programs\Python\Python35-32\lib\site-packages\googleapiclient\http.py", line 838, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 500 when requesting https://sheets.googleapis.com/v4/spreadsheets/12YdppOoZUNZxhXvcY_cRgfXEfRnR_izlBsF8Sin3rw4?alt=json&includeGridData=true returned "Internal error encountered.">
不久后重试,我又收到另一个错误:
Traceback (most recent call last):
File "Google_sheets.py", line 164, in <module>
ss=Spreadsheet(SPREADSHEET_ID)
File "Google_sheets.py", line 83, in __init__
spreadsheetId=self.ssId, includeGridData=True).execute()['sheets']}
File "C:\Users\Larsson\AppData\Local\Programs\Python\Python35-32\lib\site-packages\oauth2client\util.py", line 137, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Users\Larsson\AppData\Local\Programs\Python\Python35-32\lib\site-packages\googleapiclient\http.py", line 838, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 503 when requesting https://sheets.googleapis.com/v4/spreadsheets/12YdppOoZUNZxhXvcY_cRgfXEfRnR_izlBsF8Sin3rw4?includeGridData=true&alt=json returned "The service is currently unavailable.">
500 和 503 是 Google 服务器问题。您将需要实施指数退避,以便您可以再次重试交易。检查此 link - https://developers.google.com/admin-sdk/directory/v1/limits
而且,所有 API 都有使用限制。看看这个 link - https://developers.google.com/gmail/api/v1/reference/quota
如 Standard Error Responses 中所述,错误代码 #500 和 #503 是与服务器相关的错误。建议的操作是不要多次重试查询。
要处理这些错误代码:
A 500 or 503 error might result during heavy load or for larger more complex requests. For larger requests consider requesting data for a shorter time period. Also consider implementing exponential backoff.
如果大量请求或繁重的网络流量导致服务器出现 return 错误,指数退避可能是处理这些错误的好策略。
除此之外,您还应该检查您的申请是否超过 usage limits。如果是这样,则可能应该优化您的应用程序代码以发出更少的请求。如果需要,您可以在项目的“配额”选项卡下的 Google API 控制台中选择请求额外的配额。
已解决,问题出在Google这边。在请求 sheet 时发生,其中包含包含 invalid/unselected 间隔的图表。向 Google 报告错误。
通过将所有无效图表更改为有效范围来修复。
我也遇到了这个错误,经过一些摆弄后,我发现它与我的下拉框上的数据验证有关。重新编辑您的验证,select 相同的单元格并重新保存、冲洗并重复所有此类字段,它应该可以工作。
PS:鉴于这似乎会影响其他类型的数据,我建议您删除文档的某些部分,直到它开始在脚本端工作,这样您的最后一个操作就会指出哪些单元格有问题。