urlfetch

Binance API with Google Script

♀尐吖头ヾ 提交于 2019-12-04 21:40:52
I am attempting to pull my trade history from Binance (using signed endpoint security) into google sheets so that I can keep records of all my trades using google scripts. I am stuck where I can't pull the data using the api keys. The below snippit is as far as I could get from my understaning of the Binance API and UrlFetchApp API. var data = UrlFetchApp.fetch(" https://api.binance.com/api/v3/myTrades ", {headers : apiKey}) I also have found this post . Binance API Website You can't add the header in the url bar. EDIT I see you are using UrlFetchApp. In that case, the correct syntax is var

Google App Engine ( Java ) : URL Fetch Response too large problems

自闭症网瘾萝莉.ら 提交于 2019-12-04 17:19:46
I'm trying to build some sort of webservice on google apps. Now the problem is, I need to get data from a website (HTML Scraping). The request looks like : URL url = new URL(p_url); con = (HttpURLConnection) url.openConnection(); InputStreamReader in = new InputStreamReader(con.getInputStream()); BufferedReader reader = new BufferedReader(in); String result = ""; String line = ""; while((line = reader.readLine()) != null) { System.out.println(line); } return result; Now App Engine gives me the follwing exception at the 3th line: com.google.appengine.api.urlfetch.ResponseTooLargeException This

Asynchronous URLfetch when we don't care about the result? [Python]

假装没事ソ 提交于 2019-12-04 06:30:27
In some code I'm writing for GAE I need to periodically perform a GET on a URL on another system, in essence 'pinging' it and I'm not terribly concerned if the request fails, times out or succeeds. As I basically want to 'fire and forget' and not slow down my own code by waiting for the request, I'm using an asynchronous urlfetch, and not calling get_result(). In my log I get a warning: Found 1 RPC request(s) without matching response (presumably due to timeouts or other errors) Am I missing an obviously better way to do this? A Task Queue or Deferred Task seems (to me) like overkill in this

Sending multiple POST data items with the same name, using AppEngine

。_饼干妹妹 提交于 2019-12-04 05:17:38
I try to send POST data to a server using urlfetch in AppEngine. Some of these POST-data items has the same name, but with different values. form_fields = { "data": "foo", "data": "bar" } form_data = urllib.urlencode(form_fields) result = urlfetch.fetch(url="http://www.foo.com/", payload=form_data, method=urlfetch.POST, headers={'Content-Type': 'application/x-www-form-urlencoded'}) However, in this example, the server seems to receieve only one item named data , with the value bar . How could I solve this problem? Modify your form_fields dictionary so that fields with the same name are turned

GAE Golang - urlfetch timeout?

我怕爱的太早我们不能终老 提交于 2019-12-03 16:23:17
I am having issues with urlfetch's timeouts on Google App Engine in Go. The app does not appear to want to take a longer timeout than about 5 seconds (it ignores a longer timeout and times out after its own time). My code is: var TimeoutDuration time.Duration = time.Second*30 func Call(c appengine.Context, address string, allowInvalidServerCertificate bool, method string, id interface{}, params []interface{})(map[string]interface{}, error){ data, err := json.Marshal(map[string]interface{}{ "method": method, "id": id, "params": params, }) if err != nil { return nil, err } req, err:=http

Google App Script external API return error 406

若如初见. 提交于 2019-12-02 09:53:29
I'm trying to fetch a URL using optional advanced parameters in GAS: function myFunction() { var options = {}; options = { headers: { Authorization: 'Bearer ?????', 'Content-Type': 'application/json', }, }; UrlFetchApp.fetch(<url>, options); } I always get: Request failed for returned code 406 (line 52, file "Project"). HTTPResponse: SyntaxError: Empty JSON string I did the same fetching in Excel Power Query: let Source = Json.Document(Web.Contents(<URL>, [Headers=[Authorization="Bearer ?????????????", ContentType="application/json"]])), And it works, it works also using Postman... What's the

Send email using GMail API in Google Apps Script

时光怂恿深爱的人放手 提交于 2019-12-02 00:21:54
问题 I have a raw email (tested on playground and working) and I want to send it with Google's Gmail API from Google Apps Script. I can't find the right syntax for the request: var RequestUrl = "https://www.googleapis.com/gmail/v1/users/emailAccount/messages/send"; var RequestArguments = { muteHttpExceptions:true, headers: {Authorization: 'Bearer ' + token 'GData-Version': '3.0', 'Content-Type': "message/rfc822", }, payload: {"raw":raw}, method:"post" }; var result = UrlFetchApp.fetch(RequestUrl

got Validation of viewstate MAC failed when sending post request from google app engine via url fetch service

梦想与她 提交于 2019-12-02 00:01:24
问题 I have a task to fetch html from a website, before I go to that page I need to log in. I use a low-level api url fetch service. Here is my code test code: private String postPage(String loginPageHtml) throws IOException{ String charset = "UTF-8"; Document doc = Jsoup.parse(loginPageHtml); Iterator<Element> inputHiddensIter = doc.select("form").first().select("input[type=hidden]").iterator(); String paramStr = ""; paramStr += "Username" + "=" + URLEncoder.encode("username", charset) + "&";

Send email using GMail API in Google Apps Script

旧街凉风 提交于 2019-12-01 21:37:58
I have a raw email (tested on playground and working) and I want to send it with Google's Gmail API from Google Apps Script. I can't find the right syntax for the request: var RequestUrl = "https://www.googleapis.com/gmail/v1/users/emailAccount/messages/send"; var RequestArguments = { muteHttpExceptions:true, headers: {Authorization: 'Bearer ' + token 'GData-Version': '3.0', 'Content-Type': "message/rfc822", }, payload: {"raw":raw}, method:"post" }; var result = UrlFetchApp.fetch(RequestUrl,RequestArguments); What is wrong with my syntax? In Google Apps Script, you can use the Advanced Gmail

How can I fetch() more than 1MB on Google App Engine?

♀尐吖头ヾ 提交于 2019-12-01 21:23:32
问题 Google App Engine limits urlfetch.fetch() responses to 1MB. Is there any workaround of this (switching to paid version maybe)? I'm using Python and if it's possible to provide an example that would be great. 回答1: With the brand new SDK 1.4.0 you can download 32MByte; keep in mind that you still have the 10 seconds Deadline limit though ;-) . deadline can be up to a maximum of 60 seconds for request handlers and 10 minutes for tasks queue and cron job handlers. URLFetch allowed response size