无法在 Google 应用脚本中使用 fetchURL() [英] Unable to use fetchURL() in Google apps scripts

查看:24
本文介绍了无法在 Google 应用脚本中使用 fetchURL()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 Google 应用程序脚本调用以下 URL.在我的浏览器中它工作正常,但是当从 Apps 脚本运行时,我收到错误拒绝访问".

I am trying to call the below URL from Google apps script. In my browser it works fine, but when run from Apps script I get the error 'Access denied'.

var response=UrlFetchApp.fetch(url);//Fails with Access denied exception

网址:获取 JSON 格式的股票数据

'请求失败 http://www.nseindia.com/live_market/dynaContent/live_watch/get_quote/ajaxGetQuoteJSON.jsp?symbol=AXISBANK&ser​​ies=EQ 返回代码 403.截断的服务器响应:访问被拒绝

访问被拒绝

您无权访问http://www.ns...(使用 muteHttpExceptions 选项检查完整响应)"

'Request failed for http://www.nseindia.com/live_market/dynaContent/live_watch/get_quote/ajaxGetQuoteJSON.jsp?symbol=AXISBANK&series=EQ returned code 403. Truncated server response: Access Denied

Access Denied

You don't have permission to access "http://www.ns... (use muteHttpExceptions option to examine full response)'

我需要做任何额外的事情吗?

Do i need to do anything extra?

推荐答案

状态 403 表示一切都按计划进行,但收件人拒绝了请求.没有来自主机站点的澄清,很难说为什么它拒绝请求,但可能是由于您的代码问题导致请求被拒绝,或者他们可能有适当的服务来阻止这些类型的请求未经授权的 IP.

Status 403 indicates that everything went as planned, but the recipient denied the request. Without clarification from the host site, it's hard to say why it's rejecting the request, but it could be anything from the request being denied due to an issue with your code, or they may have a service in place that prevents these kinds of requests from unauthorized IPs.

由于您所连接的网站的性质以及滥用的可能性,他们甚至可能将 Google 应用程序脚本专门列入黑名单.

They may even have blacklisted Google apps script specifically, due to the nature of the site you're connecting too, and the potential for abuse.

这篇关于无法在 Google 应用脚本中使用 fetchURL()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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