Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9788

HTTP GET to Binance API via Google Script

$
0
0

This might be related to the following topic. I understand that I should not add a BODY to a GET, but it doesn't seem to solve my problem.

I am trying to reach Binance API's avgPrice through Google Script.The request through my browser works as intended.

This is my code:

function averagePrice() {    var key = '***'    var api = "/api/v3/avgPrice";    var baseUrl = "https://api.binance.com";    var params =     {'method': 'GET','headers': {'X-MBX-APIKEY': key},'muteHttpExceptions': true    };    var url = baseUrl + api +'?symbol=EURUSDT';    var d = UrlFetchApp.fetch(url, params);    Logger.log(d.getContentText());}

The response I get is as follows:

[20-08-06 20:14:14:955 CEST] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><HTML><HEAD><META HTTP-EQUIV="Content-Type"CONTENT="text/html; charset=iso-8859-1"><TITLE>ERROR: The request could not be satisfied</TITLE></HEAD><BODY><H1>403 ERROR</H1><H2>The request could not be satisfied.</H2><HR noshade size="1px">Request blocked. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.<BR clear="all">If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.<BR clear="all"><HR noshade size="1px"><PRE>Generated by cloudfront (CloudFront) Request ID: -m-__LPRs7J_orooCPROW2R4JjqiaQGauojl7fEoi2JxDXeIDbwJOQ==</PRE><ADDRESS></ADDRESS></BODY></HTML>

Viewing all articles
Browse latest Browse all 9788

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>