google-app-engine

Google DataStore with objectify - composite queries on HashMap

六眼飞鱼酱① 提交于 2020-01-05 05:46:06
问题 I am using Google App Engine for my REST service backend and Google dataStore as the DB and objectify for accessing datastore. One of the properties in my entity is Map<String,String> customAttrs; This is because I don't know before hand what all parameters can come from the client. My requirement is that I want to be able to index on these parameters in the HashMap. I looked at the following question: GAE w/ Objectify - Can you query a HashMap? and tried out what was mentioned in the

Google App Engine: How to connect to Cloud SQL with Zend DB

只愿长相守 提交于 2020-01-05 05:46:06
问题 I have a Zend Framework 1.12 application that uses the Zend DB Adapter class to connect with MySql. I need to deploy it soon and am investigating Google App Engine. My current problem is that I can't connect the application to Google Cloud SQL. This Google page, https://developers.google.com/appengine/docs/php/cloud-sql/, gives an example using PHP and PDO. It uses a DSN as a parameter. The Zend DB Adapter class does not take a DSN as a parameter, but instead constructs it from the other

How to override a timestamp field for unit test purposes?

此生再无相见时 提交于 2020-01-05 05:43:09
问题 class Record(ndb.Model): notes = ndb.TextProperty() last_updated = ndb.DateTimeProperty(auto_now=True) Part of Unit Test setup: record2 = Record() # trying to set the last_updated timestamp to a previous date record2.last_updated = previous_date record2.put() #after saving it, the timestamp is back to today's date Hence I can't emulate an old record for my unit testing. How do I override that field without having to change the model? 回答1: From the docs It is possible to override the value for

Log that a request was responded to after responding

ぃ、小莉子 提交于 2020-01-05 05:24:07
问题 This probably is a very noobish question, but I want to make sure my code is doing what I think it's doing. Here's what I'm after - get a request, make a decision, respond to it the request with the decision, and only then log it. The sequence is important because writes can be slow and I want to make sure that a response is published before any writes take place. Here's the sample code: class ConferenceGreetingHandler(webapp.RequestHandler): def get(self): self.post() def post(self): xml

Unable to get Google endpoints working over multiple services

删除回忆录丶 提交于 2020-01-05 04:55:13
问题 Thanks to asamarin I've been able to figure out how to get different endpoints within the same google app engine (cf Using Google endpoints in different modules of the same app). But I can't make it work (at least with the dev server, I've not tried to pushed it to the cloud). I have two modules: module1 and module2, each of them running an independent api (using google endpoints so). In each moduleX/main.py I have this code: import endpoints from protorpc import remote # ... some code

Google Cloud Endpoint Authentication from my Android Client: Audience not Allowed and Oauth framework user didn't match oauth token user

孤街浪徒 提交于 2020-01-05 04:36:09
问题 I'm trying to access a deployed appengine backend api using OAuth2.0 support from my android client. Authentication is working fine from the api explorer using the authorised email address On the android side, I'm using the credentials/account picker method described here: https://developers.google.com/appengine/docs/python/endpoints/consume_android But I get a 403 status code saying the access is forbidden and the following in the appengine log when accessing from an android client: D 12:52

How to see logging module output module under GAE?

余生颓废 提交于 2020-01-05 04:34:41
问题 I'm trying to debug this code. With this goal, I'm trying to use logging following this tutorial. With this goal, I insert this code in my script: import logging logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') logging.debug('This is a log message.') And, in the section where I wanted to get the message logging, I inserted the line: logging.debug ('This is a log message.') this way: def fcount(self,f,cat): res = db.GqlQuery("SELECT * FROM fc WHERE

Are Cloud Endpoints with Go Google App Engine Standard possible?

馋奶兔 提交于 2020-01-05 04:25:09
问题 I have implemented a simple API in Go on Google App Engine Standard using just: func init() { http.HandleFunc("/api/v1/resource",submitResource) } Nothing special. However I want to port this code to using Cloud Endpoints instead in order to get the better monitoring and diagnostics. Is it even possible with STANDARD instances or must I move to FLEXIBLE? I can't find any documentation on this. Nor answers to this seemingly simple question. At the moment I half wish I had chosen Python because

Add properties to Google Datastore entity dynamically

情到浓时终转凉″ 提交于 2020-01-05 04:07:13
问题 I have a below use case: I have a method that accepts a list of strings. For each of the strings, I need to create a property under an existing google data store entity A Example: I have an existing entity Person with properties fname and lname . If the input list has strings - address , city , I need to update the entity Person to include these new properties address and city . I'm coding this use case in Python. Any suggestions on how I can achieve this? 回答1: So the best way to do this is

AppEngine Multiple User Credentials in Development Server

爱⌒轻易说出口 提交于 2020-01-05 04:05:35
问题 When auth-constraint is specified in AppEngine Development server web.xml file. The User injected to endpoint and User received from UserService.getCurrentUser() in HttpServlet are different. The user Id for endpoint user is zero and for HttpServlet it is a fixed number. When the auth-constraint tag is removed from web.xml file, both user ids are zero. But this tag is required for production server. How to get a single user for development server? <security-constraint> <web-resource