如何修复 IMPORTJSON 返回 403 HTTP 错误代码?

How to fix IMPORTJSON returning 403 HTTP error code?

我一直在尝试从 SEC EDGAR 导入 JSON 文件,但没有成功。它显示以下错误:

Exception: request failed for https://data.sec.gov returned code 403. Truncated server response: <html xmlns="http://www.w... (use muteHttpExceptions option to examine full response) (line 220)

我一直在使用的函数可以在这里找到(没有修改):https://github.com/bradjasper/ImportJSON

它在其他网站上工作正常,到目前为止我遇到问题的唯一网站是 SEC EDGAR 网站:https://data.sec.gov/api/xbrl/companyconcept/CIK0000320193/us-gaap/AccountsPayableCurrent.json

原因是:

Your Request Originates from an Undeclared Automated Tool. To allow for equitable access to all users, SEC reserves the right to limit requests originating from undeclared automated tools. Your request has been identified as part of a network of automated tools outside of the acceptable policy and will be managed until action is taken to declare your traffic.

function getStatusCode(url='https://data.sec.gov/api/xbrl/companyconcept/CIK0000320193/us-gaap/AccountsPayableCurrent.json'){
   var options = {
     'muteHttpExceptions': true,
     'followRedirects': false
   };
   var url_trimmed = url.trim();
   var response = UrlFetchApp.fetch(url_trimmed, options);
   Logger.log (response.getResponseCode());
   Logger.log (response.getContentText())
}

我知道的唯一方法是手动复制单元格中的 json 然后解析它