How to access app engine data model from desktop python application? - python

I am attempting to create a python application on a Raspberry Pi that can access data stored in a db model on an App Engine application. Specifically the latest entry in the data store.
I have no experience doing this type of remote data access but have a fair bit of experience with App Engine and Python.
I have found very little that I understand on this subject of remote data access.
I would like to access the data store directly, not text on a web page like this.
ProtoRPC kind of looks like it may work but Im not familiar with it and it looks like it is pretty involved when I just need to access a few strings.
What would make the most sense to accomplish this? If an example is easy to provide I would appreciate it.

What you looking for is the appengine remote api.
https://cloud.google.com/appengine/docs/python/tools/remoteapi

Google App Engine doesn't allow direct access to it's databases from your local python script. Instead, only an application hosted on App engine's server can access that data for your application.
Essentially, you're looking for a Google App Engine compatible, automatic, Restful API. Several exist, and have been discussed here. YMMV with the various frameworks that are discussed there.

Related

Serve streaming video in Google App Engine

I'm building a small educational web application. Along with other features like discussion forums, registered users will be able to view streaming videos. I'll be using Google App Engine's webapp2 framework for back-end development (with python). I want to specifically ask that how can I integrate video streaming into my application? I'm fairly new to web development and have a basic working knowledge of App Engine. I'll be using Google's Datastore to store all the app's data, but where do I store my videos that the app serves to users? I don't want to make the video content publicly available (e.g. YouTube), so what's the way to go?
I'm aware that GAE's Blobstore is dedicated to serving large files (e.g. videos) so will it be appropriate for this purpose? What are some other options?
Yes, Blobstore is fine. You can also use Google Cloud Storage, either directly or through the Blobstore API
Plenty of related Q&As to study, many contain code snippets: https://stackoverflow.com/search?q=[google-app-engine]+video+streaming
.

send data from localhost to app engine entity

I used to do this a while back (about 3 years ago). I don't remember how, so maybe someone here can help me.
I create some entities in localhost datastore. Now I need to transfer the entities to the production datastore. I have existing entities in the store that I do not wish to delete. I just want to admit the additional data to production. Any ideas how I might do this?
You can enable remote API for your application, then use a locally running program to auth to the remote API and do datastore operations. This is outlined on the docs paged linked.

Do I need OAuth process if my GAE app should use Analytics API?

I would like to display on my GAE website a number of daily users of my android application (tracked with Google Analytics), both are under the same account. I wanted to use Analytics API for this. I am reading Hello Analytics API tutorial and looks like I need OAuth to authorize my app to get the data from Analytics. It looks quite complex, is there any easy way (like getting some token and using it)?
Looks like I need service account (for server to server applications), but I don't understand how to modify starter application (taken there) to use it.
Since you only want to access data that you own, using a service account is a good idea.
How ever the starter application you linked is for working with a normal OAuth2 and its not the same as the code for a service account.
I haven't done this in python myself before, but i found an example that should get you started. You will need to change it slightly because the scopes are for Google+ not Google analytics. create the service in python on GAE
If you have any problems changing it to work with Google Analtyics let me know i should be able to help with that. Even if i cant test the python code myself.
There is much simpler way to pass authorization - see App Identity doc. See also Java example how to access Analytics data from the GAE.
Another useful link is here.

Deciding to WSGI or Django for new web app

I'm in the process of setting up a new web app and deciding whether to just do it with WSGI or go the full framework route with Django.
The app's foremost requirements:
1) The app has no UI what so ever and all of the data is exposed to clients via a REST api with JSON.
2) It will have data to persist so MongoDB & probably Amazon's SimpleDB will be used for the database side.
Is there a reason to use Django or can I get marginal speed improvement with WSGI only?
Previous server-side apps I've built were either with Java/Struts and Groovy/Grails on the JVM. My understanding is that Django is an MVC framework similar to Rails and Grails.
I've also played around with Google App Engine which uses WSGI as thin layer above your code for managing and routing requests.
I suggest you consider something between those two extremes. Flask is lightweight, very easy to use, and connects to your web server via wsgi. You can use regular python database connectors with it, and a few databases even have Flask-specific extension modules.
I have worked with Django for a couple of projects and I like it a lot, but since you are going to use mongoDB and a lot of JSON I suggest you use NodeJS as server side, with Express as framework, you can see a brief tutorial here:
http://howtonode.org/express-mongodb
One of the advantages of this is that you will use only javascript all along your project, I began working with this technology the last month in a Hackathon, and I can tell you that I'm very impressed of how fast and simple it is.
I've worked a bit with some django "apps" ,its really easy, but setting up the "apps" can be a bit of a long process. Django has a lot of nice features that you won't be using and I agree that you might be on one "extreme" here.

is it possible to share a datastore between multiple GAE applications

I like to work with data saved in one GAE application in other GAE applications.
Basically share the datastore between multiple web applications in Google App Engine (Python) Development and Production.
Also if possible with:
http://localhost:####/_ah/admin/datastore
I like to view data in other applications not runnings and/or running on one screen?
Thanks for the help!
Nope, datastores are totally contained within the application. There is no direct sharing of data from one app to another.
You could however expose a web service to make data from one application available to another, using REST for example.
I guess the core problem here is that you would like to share the data between two applications hosted on GAE. There are two ways to do that.
You could use Google Cloud Datastore to store the information. This gives you more flexibility as you can have different services accessing datastore. You could even have something running on google compute engine and communicating with datastore.
Use google appengine modules. All modules share the same datastore. In your case each module could be a different application.
Hope this helps.
No, a datastore can only be accessed by one application (but that app can serve up multiple sites).
If you want Google to allow multiple applications to directly access the same datastore then you should star this issue:
http://code.google.com/p/googleappengine/issues/detail?id=1300
Unfortunately the way this issue is written is a bit ambiguous, but I take it to mean 'multiple applications' rather then 'multiple accounts'.
FWIW, you can deploy an application with another version and language - but with the same id, and be able to access its datastore concurrently

Categories