“意外错误"使用UrlFetch时抛出 [英] "Unexpected error" thrown when using UrlFetch

查看:48
本文介绍了“意外错误"使用UrlFetch时抛出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一段时间以来,我一直在使用App脚本下载CM360报告并将其插入Google表格,但是几天后,在运行代码时出现以下错误:

I have been using App Scripts to Download and insert CM360 reports into Google Sheets for a while now, but since a couple of days back I get the following error when running the code:

异常:意外错误: https://www.googleapis.com/dfareporting/v3.4/reports/xxx/files/xxx?alt=media (代码:23:56)

我正在运行的代码示例:

Example of the code I am running:

function runreport() {
var reportId = xxx;
var profileId = xxx;
var additionalParameters = {'synchronous': 'true'};

var ReportFile = DoubleClickCampaigns.Reports.Files.list(profileId,reportId);
var ReportFileID = (ReportFile.items[0].id);
var newReportFile = DoubleClickCampaigns.Files.get(reportId, ReportFileID);

if(newReportFile.urls) {var httpOptions = {'headers': {'Authorization':'Bearer ' + ScriptApp.getOAuthToken()}};
var csvContent = UrlFetchApp.fetch(newReportFile.urls.apiUrl, httpOptions).getContentText();
var csvData = Utilities.parseCsv(csvContent);}}

还有其他人遇到此问题并设法解决吗?

Do anyone else encountered this issue and have managed to solve it?

推荐答案

意外错误是由于 UrlFetchApp

出现了新错误

它已被服务器提交多次,例如此处.

因此,与其再次提交,不如将其加星标".已经存在的问题-提高其可见性.

So instead of filing it again you should rather "star" the already existing issue - to increase its visibility.

这篇关于“意外错误"使用UrlFetch时抛出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆