Unexpected error on UrlFetchApp.fetch in Google Apps Script using basic authentication
This is related to a new bug, see here Many users are affected, I recommend you to “star” the issue to increase visibility and hopefully accelerate the process.
This is related to a new bug, see here Many users are affected, I recommend you to “star” the issue to increase visibility and hopefully accelerate the process.
When UrlFetchApp is used by the custom function and the script editor, I think that the difference is whether IPv6 is used, while the address of IPv4 is changed every run. In this case, the results of the script editor and custom menu are the same. I thought that this might be the reason of … Read more
Here you can find cookies specification: http://www.w3.org/Protocols/rfc2109/rfc2109 You have a potential issue in your code: response.getAllHeaders()[‘Set-Cookie’] can return either a string or a table of string if multiple ‘set-cookie’ attributes are sent back from the server. Eric is right, you cannot return the cookie without digesting it. Second error in your code: var opt2 = … Read more
This question has been answered on another else where. Here is the summary: Bruce Mcpherson basic authentication looks like this… var options = {}; options.headers = {“Authorization”: “Basic ” + Utilities.base64Encode(username + “:” + password)}; Lenny Cunningham //Added Basic Authorization////////////////////////////////////////////////////////////////////////////////////////// var USERNAME = PropertiesService.getScriptProperties().getProperty(‘username’); var PASSWORD = PropertiesService.getScriptProperties().getProperty(‘password’); var url = PropertiesService.getScriptProperties().getProperty(‘url’);//////////////////////////Forwarded Ports to WebRelay … Read more
Simplifying your original version as far as possible: import threading import urllib2 import time start = time.time() urls = [“http://www.google.com”, “http://www.apple.com”, “http://www.microsoft.com”, “http://www.amazon.com”, “http://www.facebook.com”] def fetch_url(url): urlHandler = urllib2.urlopen(url) html = urlHandler.read() print “‘%s\’ fetched in %ss” % (url, (time.time() – start)) threads = [threading.Thread(target=fetch_url, args=(url,)) for url in urls] for thread in threads: thread.start() … Read more