[英]Is there any way to change User-Agent of Apps script?
I am trying to change User-Agent
.我正在尝试更改
User-Agent
。 But It seems like I can't change it.但是好像改不了。
I implemented like this:我是这样实现的:
{
'User-Agent': "my spreadsheet"
}
the value above passes API function like this:上面的值通过这样的 API 函数:
function API(m_headers, method, data){
var options = {
'headers': m_headers,
'muteHttpExceptions' : false,
'method' : method,
'payload' : data
};
var url = base_url+api;
try{
var response = UrlFetchApp.fetch(url, options)
}catch(e){
return url+"\n"+JSON.stringify(e);
}
}
And I get Attribute provided with invalid value in Google Apps Script
error.我
Attribute provided with invalid value in Google Apps Script
错误中得到Attribute provided with invalid value in Google Apps Script
。
{"message":"Attribute provided with invalid value: headers","name":"Exception","fileName":"Code","lineNumber":42,"stack":"\tat Code:42 (API)\n"}
How can I solve this?我该如何解决这个问题?
Nope.不。 The number of supported consistent headers is strictly limited.
支持的一致标头的数量受到严格限制。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.