urlfetch

How to authenticate requests across internal App Engine modules?

久未见 提交于 2019-12-10 10:16:02
问题 I have an application in Google App Engine that consists in 2 modules ( A and B ). A handles user requests and it's available without authentication. B is a microservice that perform certain tasks when A requires it. So we have A making requests to B using urlfetch : from google.appengine.api import urlfetch from google.appengine.api import app_identity rpc = urlfetch.create_rpc() urlfetch.make_fetch_call( rpc, "https://b-dot-my-project.appspot.com/some/url", method='GET', follow_redirects

Start backend with async urlfetch on Google App Engine

不羁岁月 提交于 2019-12-10 06:43:24
问题 I am experimenting with several of GAE's features. I 've built a Dynamic Backend but I am having several issues getting this thing to work without task queues Backend code: class StartHandler(webapp2.RequestHandler): def get(self): #... do stuff... if __name__ == '__main__': _handlers = [(r'/_ah/start', StartHandler)] run_wsgi_app(webapp2.WSGIApplication(_handlers)) The Backend is dynamic. So whenever it receives a call it does it's stuff and then stops. Everything is worikng fine when I use

Create a POST body using Google Apps Script

天大地大妈咪最大 提交于 2019-12-08 09:59:13
问题 I'm trying to create a Google Apps Script that adds a new owner to the user's Google calendar. The first code block below works correctly (returns the calendar ACL in JSON format). How can I add a new user to the acl using Google Apps Script? The second code block shows my attempt to insert a new rule into the acl. function getCalendarACL() { // Get Calendar ID, script user's email, and the API Key for access to Calendar API var calId = 'abc123@group.calendar.google.com'; var userEmail =

deadline = None after using urlfetch.set_default_fetch_deadline(n)

一个人想着一个人 提交于 2019-12-08 04:32:29
问题 I'm working on a web application with Python and Google App Engine. I tried to set the default URLFetch deadline globally as suggested in a previous thread: https://stackoverflow.com/a/14698687/2653179 urlfetch.set_default_fetch_deadline(45) However it doesn't work - When I print its value in one of the functions: urlfetch.get_default_fetch_deadline() is None. Here is main.py: from google.appengine.api import users import webapp2 import jinja2 import random import string import hashlib import

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

青春壹個敷衍的年華 提交于 2019-12-06 10:44:39
问题 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

UrlFetchApp.fetch() incomplete content on google.com

断了今生、忘了曾经 提交于 2019-12-06 10:06:11
I'm starting with Google Apps Script coding. So I tried this example: fetch(url) // The code below logs the HTML code of the Google home page. var response = UrlFetchApp.fetch("http://www.google.com/"); Logger.log(response.getContentText()); I'm receiving the tags from: <!doctype html> to <style> But there aren't these tags: </head>, <body>, </body> or </html> Is it an incorrect Google Apps Script example or is it a mistake on my part? How can I response the complete HTML code from google.com? Logger.log automatically truncates the strings displayed after a certain length. You are receiving

HttpURLConnection App Engine Java Example for POST Request does not work

蓝咒 提交于 2019-12-06 06:58:36
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.InputStreamReader; import java.io.IOException; import java.io.OutputStreamWriter; String message =

How to authenticate requests across internal App Engine modules?

空扰寡人 提交于 2019-12-06 03:08:52
I have an application in Google App Engine that consists in 2 modules ( A and B ). A handles user requests and it's available without authentication. B is a microservice that perform certain tasks when A requires it. So we have A making requests to B using urlfetch : from google.appengine.api import urlfetch from google.appengine.api import app_identity rpc = urlfetch.create_rpc() urlfetch.make_fetch_call( rpc, "https://b-dot-my-project.appspot.com/some/url", method='GET', follow_redirects=False, headers = { 'X-Appengine-Inbound-Appid': 'my-project', }, ) response = rpc.get_result() B 's app

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

五迷三道 提交于 2019-12-06 01:26:20
问题 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

Convert php curl to GAE urlfetch for iTunes InApp verifyReceipt

拈花ヽ惹草 提交于 2019-12-05 14:25:38
Can someone help to convert this PHP Curl to UrlFetch ? This is used for Apple iTunes verifyReceipt if (getiTunesProductionLevel($app_id)=="sandbox" || $sandbox_override == TRUE) { $endpoint = 'https://sandbox.itunes.apple.com/verifyReceipt'; } else { $endpoint = 'https://buy.itunes.apple.com/verifyReceipt'; } $postData = json_encode(array( 'receipt-data' => $receipt, 'password' => $sharedSecret)); $ch = curl_init($endpoint); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST,