urlfetch

HttpURLConnection App Engine Java Example for POST Request does not work

别说谁变了你拦得住时间么 提交于 2019-12-12 10:08:03
问题 I am trying to do a POST request using urlfetch under an app engine application. I have followed the instructions (and code) extracted from the simple example found at the App Engine documentation (here https://developers.google.com/appengine/docs/java/urlfetch/usingjavanet), under the section "Using HttpURLConnection". import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLEncoder; import java.io.BufferedReader; import java.io

Should Exception catch DeadlineExceededError exceptions?

◇◆丶佛笑我妖孽 提交于 2019-12-11 13:17:16
问题 I have the code like below: try: response = urlfetch.Fetch(url, deadline=60, headers=headers, follow_redirects=False) except Exception, error_message: logging.exception('Failed, exception happened - %s' % error_message) but sometimes it fails with DeadlineExceededError ? Should not this DeadlineExceededError be caught by my code? The exception details: Traceback (most recent call last): File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 266

How to use SendGrid from Google App Engine Golang?

柔情痞子 提交于 2019-12-11 13:04:13
问题 The example code at: https://sendgrid.com/blog/send-email-go-google-app-engine/ My guess this is very old sample code to use sendgrid-go on Google App Engine. I've attempted 4 permutations and failed each time with: https://api.sendgrid.com/v3/mail/send: http.DefaultTransport and http.DefaultClient are not available in App Engine. See https://cloud.google.com/appengine/docs/go/urlfetch/ Here is a minimum hardcoded attempt with some logging: package sendgridgo import( "github.com/sendgrid

GAE - urlfetch multipart post not working with large files

混江龙づ霸主 提交于 2019-12-11 12:09:29
问题 Im trying to post a file located in the Blobstore from GAE to another HTTP service (virustotal). the current snippet is working for small files (1 - 2 mb): import base64 import json import logging from poster.encode import multipart_encode, MultipartParam from google.appengine.api import urlfetch def post_file(url, file_name, file_type, file_size, file_obj, options=dict(), username=None, password=None): # Input checks if url is None: raise ValueError('url') if file_name is None: raise

Google App Engine: URLFetch maximum timeout is 250 seconds from task and not 600 seconds (10min)

浪尽此生 提交于 2019-12-11 10:10:38
问题 According to the official docs, the timeout for a http request via URLFetch on Google App Engine is 10 minutes if issued from a task: https://developers.google.com/appengine/docs/java/urlfetch/overview#Quotas_and_Limits Unfortunately I'm experiencing a 250 seconds (4:10 min) timeout no matter what I've setup as simple php test script running on Apache (but I've tested it with Lighttpd as well) that I'm calling from GAE that just waits 300 seconds and then returns Http hook: echo "Starting to

X-Appengine-Inbound-Appid header is not added in GAE flexible environment

限于喜欢 提交于 2019-12-11 08:31:31
问题 According to https://cloud.google.com/appengine/docs/flexible/go/migrating#url_fetch ,in flexible environment we can use http lib instead of urlFetch which is supposed to add GAE related headers. My app is in flexible environment but "X-Appengine-Inbound-Appid" is not set when it makes http request. My app is in python using flask framework. To test is the right headers got set, I'm making http request to the same app (different endpoint). But the inbound request doesn't have "X-Appengine

Send a text to Slack Webhook containing selected user

江枫思渺然 提交于 2019-12-11 01:08:47
问题 I am trying to send a message from Google Apps Script to Slack via a Webhook URL that works great, but I can't figure out how to send a highlighted or selected user in that text. For example '@UsernameTest how are you?' is something I want to send to a person or channel, but it doesn't work. I figured out that to highlight the channel i.e. send '@Channel' I just needed to write , but that is not what I want. I tried <@UserID> but it still didn't work. (I Received the UserID by using inspector

Determining the IP address of the node that executes the UrlFetchApp call

北慕城南 提交于 2019-12-10 20:41:39
问题 For a Web API call via UrlFetchApp in a Google Apps Script I have to submit the HTTP client IP (via HTTP-GET) for authentification (namecheap.com API). Is there a way to determine the IP address of the node that will execute the UrlFetchApp call for adding it to the query URL? 回答1: No, it is not possible. However, Google does provide you with a range of IP addresses through which the call will be made. See https://developers.google.com/apps-script/jdbc#accessing 来源: https://stackoverflow.com

google apps script ==> UrlFetchApp, method GET and cookie

ε祈祈猫儿з 提交于 2019-12-10 19:59:14
问题 I use the UrlFetchApp to send the user and pwd (method POST). After get the cookie, and use in other request (method GET). But this new request not working, I think that this cookie not has correct use in this new request. Can anyone help me? var opt ={ "method":"post", "User-Agent" : "Mozilla/5.0", "Accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Language" : "en-US,en;q=0.5", "payload": this.payload.toString(), "followRedirects" : false }; var response =

Insert image to Picasa in Python Google App Engine Sdk through urlfetch

南楼画角 提交于 2019-12-10 12:11:03
问题 I try to insert an image from a Flex application to picasa web through Google App Engine Sdk. I want to do a simple urlfetch instead of the python client library. The code i following: def Insert(self, sessionToken, album_or_uri, title, filename_or_handle): result = urlfetch.fetch(url=album_or_uri, method=urlfetch.POST, follow_redirects=True, payload=StringIO(filename_or_handle), headers={'Authorization': 'AuthSub token="' + sessionToken + '"', 'Content-Length': str(len(filename_or_handle)),