urlfetch

Unexpected exception upon serializing continuation

天大地大妈咪最大 提交于 2019-11-29 15:17:48
I get this error: Unexpected exception upon serializing continuation (not much help) It is caused by the FetchUrlApp.fetch(); call. I akm using Google Apps Script for Sites, not Google Spreadsheets. The code works in the original instance but as soon as I copy and paste the code into a new project I get the above error message. I am accessing Google Docs APIs. I have read on other forums that I need authorization but I have been unable to gain the right authorization for the code to work. No prompt ever pops up when I run a copy of the code for the first time. Code exert: var oauthConfig =

Python GAE urlfetch credentials

牧云@^-^@ 提交于 2019-11-29 12:01:01
问题 I'd like to know if the Google App Engine URL Fetch Python API does not support accessing URLs that have credentials: http://username:password@www.domain.com/ It should be a basic feature, but I cannot get it to work and could not find any documentation about it being supported or not as well. 回答1: SOLUTION - here's how it should be done: result = urlfetch.fetch("http://www.domain.com/", headers={"Authorization": "Basic %s" % base64.b64encode("username:password")}) 来源: https://stackoverflow

GoogleAppEngine urlfetch timeout exception

落爺英雄遲暮 提交于 2019-11-29 02:53:04
问题 Has anyone got any experience with the following exception when using GAE urlfetch? DownloadError: ApplicationError: 2 timed out I'm trying to send a HTTP POST request. Like so: result = urlfetch.fetch('http://api.nathan.com:8080/Obj/', method='POST', payload=postdata, deadline=10) I've tried setting deadline to the max (10 seconds). The request from the command line (using curl or httplib2) takes about a second. nchong@almond ~ $ time curl -d "<Obj><a>1</a><b>n</b></Obj>" http://api.nathan

GAE - AppEngine - DeadlineExceededError: Deadline exceeded while waiting for HTTP response from URL:

南笙酒味 提交于 2019-11-29 01:23:14
I have a Google AppEngine application which runs great on my local machine. The app posts a image (from a url) to my facebook wall. However, when I deploy it to Google's servers, I get an error: DeadlineExceededError: Deadline exceeded while waiting for HTTP response from URL: The offending code is: facebook_access_token = facebook_info['access_token'] facebook_post_url = 'https://graph.facebook.com/me/photos?access_token=%s&url=%s&name=%s&method=post' % (facebook_access_token, url, caption) facebook_post_url = facebook_post_url.replace(" ", "+"); facebook_result = urlfetch.fetch(facebook_post

Loading a custom key store in Google App Engine Java application

孤人 提交于 2019-11-28 21:17:15
I want to open a HTTPS connection in a Google App Engine app using the URLFetch service. To be able to verify the SSL certificate of the server my app is talking to, I am using my own keystore file . I want to read this file in a warmup request when my app is loaded i.e. before any HTTPS requests are performed. The keystore file is part of my WAR file. TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); keystore.load(ClassLoader.getSystemResourceAsStream(

Using Google Apps Script to scrape Dynamic Web Pages

ぐ巨炮叔叔 提交于 2019-11-28 12:28:44
问题 I would like to read some data from other websites for a project using Google Script. The pages in questions are Dyanmic ; they contain content that is loaded after the initial page load, via JavaScript calls to the server. Usually, with somewhat static content, this works fine but I am new to JavaScript and to Google Apps Script and thus do not know how to get the content if it is loaded asynchronously via JavaScript (e.g. via AJAX). An example can be found here showing the last tracks

Google Apps Script UrlFetchApp returning Unauthorized Error 401

白昼怎懂夜的黑 提交于 2019-11-28 11:20:19
问题 This is the code I'm using. function doc_to_html(id) { var url = "https://docs.google.com/feeds/download/documents/export/Export?id="+id+"&exportFormat=html"; var param = { method : "get", headers : {"Authorization": "Bearer " + ScriptApp.getOAuthToken()}, muteHttpExceptions:true, }; var html = UrlFetchApp.fetch(url,param).getContentText(); Logger.log(html); } It worked several times for testing, but now it's returning "Unauthorized Error 401." More accurately, it is returning: <html> <head>

Replacing CURL with urlfetch in PHP

泪湿孤枕 提交于 2019-11-28 10:31:22
I'm creating an application for Google App engine, where CURL isn't allowed. As far as I know, urlFetch is the best alternative. I don't know if I can achieve the same result with urlFetch, but I would really, really appreciate it if anyone with more experience could help me out. The plan was to convert the following CURL requests to urlFetch. If anyone can point me in the right direction, or propose a better alternative, I'd greatly appreciate it. public function postCall($endpoint, $post_data, $param1, $param2, $json=1, $headers=false) { $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $this-

Unexpected exception upon serializing continuation

旧城冷巷雨未停 提交于 2019-11-28 09:08:54
问题 I get this error: Unexpected exception upon serializing continuation (not much help) It is caused by the FetchUrlApp.fetch(); call. I akm using Google Apps Script for Sites, not Google Spreadsheets. The code works in the original instance but as soon as I copy and paste the code into a new project I get the above error message. I am accessing Google Docs APIs. I have read on other forums that I need authorization but I have been unable to gain the right authorization for the code to work. No

UrlFetchApp unable to access localhost resource

梦想的初衷 提交于 2019-11-27 08:23:48
问题 This works fine: var resp = UrlFetchApp.fetch("someremotehost/SomeFile.csv"); resp.getResponseCode(); //returns 200 resp.getContentText(); //returns the data however, on my local machine, I'm running xampp with SomeFile.csv is located in htdocs/dev but I cannot get it to work on localhost: var resp = UrlFetchApp.fetch("localhost/dev/SomeFile.csv"); resp.getResponseCode(); //returns 0.0 resp.getContentText() //returns nothing! I checked with chrome-extension postman and http://localhost/dev