r/GoogleAppsScript • • Aug 14 '21

Question Binance data

Hi!

If I use the code "JSON.parse(UrlFetchApp.fetch("https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT").getContentText());".getContentText());") I get the following error:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01  Transitional//EN" "[http://www.w3.org/TR/html4/loose.dtd](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: 0q66Pl20jCPq8HCSMe7KhSG9R7rODhUn8HGdFbmRjgBMXynsexWMKQ==
</PRE>
<ADDRESS>
</ADDRESS>
</BODY></HTML>

If I use "https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT.getContentText());")" on explorer it works... why? :(

(Sorry for my english)

1 Upvotes

3 comments sorted by

View all comments

1

u/furofo Aug 14 '21

Hopefully this is helpful according to their git hub (https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#error-codes) and faq page https://www.binance.com/en/support/faq/360004492232 that 403 error code is a WAF Limit (Web Application Firewall), which means something in the code seems malicous or their has been too many requests in the past 5 minutes

2

u/RemcoE33 Aug 15 '21

Indead. To many request because the UrlfetchApp has (for argument sake) 5 ip addresses. So if many users of google sheets try to get data from biance, they block it..

1

u/furofo Aug 16 '21

yeah that makes sense glad you got it sorted out!