google-app-engine

google cloud endpoints returning java long as string in JSON

心不动则不痛 提交于 2020-02-02 04:07:29
问题 I am using google app engine latest version 1.9.30 and I define my cloud endpoint as follows @Api(name="app", version="v1", transformers={EndpointDateTransformer.class}) public class MyEndpoints { @ApiMethod(name="dummy", path="dummy", httpMethod=HttpMethod.GET) public Map<String, Object> dummy(){ Map<String, Object> dummy = Maps.newHashMap(); dummy.put("date", DateUtil.getCurrentTimestamp()); dummy.put("number", 5L); return dummy; } } here EndpointDateTransformer converts Date to Long value

Appengine - Possible to get an entity using only key string without model name?

你离开我真会死。 提交于 2020-02-01 05:46:27
问题 I want to be able to have a view that will act upon a number of different types of objects all the view will get is the key string eg: agpwb2xsdGhyZWFkchULEg9wb2xsY29yZV9hbnN3ZXIYAww without knowing the model type, is it possible to retrieve the entity from just that key string? thanks 回答1: No superclassing required, just use db.get(): from google.appengine.ext import db key_str = 'agpwb2xsdGhyZWFkchULEg9wb2xsY29yZV9hbnN3ZXIYAww' entity = db.get(key_str) 回答2: If you design your models so they

devappserver2, remote_api, and --default_partition

China☆狼群 提交于 2020-02-01 04:51:05
问题 To access a remote datastore locally using the original dev_appserver I would set --default_partition=s as mentioned here In March 2013 Google made devappserver2 the default development server, and it does not support --default_partition resulting in the original, dreaded: BadRequestError: app s~appname cannot access app dev~appname's data It appears like the first few requests are served correctly with os.environ["APPLICATION_ID"] == 's~appname' Then a subsequent request results in a call to

app engine datastore transaction exception

寵の児 提交于 2020-01-30 12:08:16
问题 In app engine transactions documentation I have found the following note: Note: If your app receives an exception when submitting a transaction, it does not always mean that the transaction failed. You can receive Timeout, TransactionFailedError, or InternalError exceptions in cases where transactions have been committed and eventually will be applied successfully. Whenever possible, make your Datastore transactions idempotent so that if you repeat a transaction, the end result will be the

Turn file uploads on for php on Google App Engine

半城伤御伤魂 提交于 2020-01-30 11:15:05
问题 I can't get the php.ini setting for file uploads to turn on. The default setting is off as described here. In the documentation it says you can add your own php.ini file and change the default settings. My php.ini file is below and the other settings are working and show when calling phpinfo. google_app_engine.enable_functions = "php_sapi_name, gc_enabled, phpinfo" upload_max_filesize = 2M max_file_uploads = 20 file_uploads = 1 回答1: Are you aware that Google App Engine only allows upload of

App Engine: Alternatives to urlfetch? Seems very unreliable

╄→尐↘猪︶ㄣ 提交于 2020-01-30 04:33:19
问题 I'm using urlfetch in my app and while everything works perfectly fine in the development environment, i'm finding urlfetch to be VERY unreliable when it's actually deployed. Sometimes it works as it should (retrieving data), but then a few minutes later it might return nothing, then it'll be working fine again a few minutes after that. This is very unacceptable. I've checked to make sure it's NOT the source URL that's the problem (YQL) and, again, everything works as it should in the

How to share sessions between modules on a Google App Engine Python application?

风流意气都作罢 提交于 2020-01-29 04:52:05
问题 I'm trying to make a basic app on Google App Engine with two modules using Google App Engine Modules(https://developers.google.com/appengine/docs/python/modules/) and They share session information between the modules: Modules: Module 1 - Login Page: a basic page with a login form where if is a valid user I create a session and then the user is redirected to the dashboard page(Module 2) Module 2 - Dashboard Page: a page that show a message if the module can read the data in the session

Google App Engine Golang - how to get user's IP address?

我们两清 提交于 2020-01-29 02:54:25
问题 I want to integrate ReCAPTCHA to my GAE Golang web application. In order to verify a captcha, I need to get user's IP address. How can I fetch user's IP address from a form post? 回答1: inside your handler function call r.RemoteAddr to receive ip:port like this: func renderIndexPage(w http.ResponseWriter, r *http.Request) { ip := strings.Split(r.RemoteAddr,":")[0] } update 02/15/2017 as @Aigars Matulis pointed out, in current version there is already a function todo this ip, _, _ := net

Google App Engine Golang - how to get user's IP address?

泄露秘密 提交于 2020-01-29 02:53:02
问题 I want to integrate ReCAPTCHA to my GAE Golang web application. In order to verify a captcha, I need to get user's IP address. How can I fetch user's IP address from a form post? 回答1: inside your handler function call r.RemoteAddr to receive ip:port like this: func renderIndexPage(w http.ResponseWriter, r *http.Request) { ip := strings.Split(r.RemoteAddr,":")[0] } update 02/15/2017 as @Aigars Matulis pointed out, in current version there is already a function todo this ip, _, _ := net

How to install PIL on Mac OSX 10.5.8 for Google App Engine?

左心房为你撑大大i 提交于 2020-01-27 15:37:05
问题 I need to get PIL installed locally to test GAE's images api in my local environment. I grabbed the PIL 1.1.6 installer for Mac, and when I go to select the destination (when installing), I get the error: You cannot install PIL 1.1.6 on this volume. PIL requires System Python 2.5 to install. I have Python 2.5.x on this machine. NOTE: Added a bounty. I am in real need of a way to test the image API locally on my Mac. 回答1: That's quite easy: Install MacPorts Install Python 2.5 with sudo port