Setting Google Talk status (with authentication) from Google App Engine - google-app-engine

I'm trying to build a site that updates users' Google Talk statuses from Google App Engine using the built in XMPP Python API (or a third-party one, if one works better than another). I've been looking around for some examples or docs explaining how I would go about doing this, but nothing I find seems to offer a fully functional solution.
App Engine's XMPP Python developer docs suggest that updating a status can be done through the send_presence() method (see here):
xmpp.send_presence(to_jid, status="My app's status")
But, how would this be authenticated? Wouldn't I have to send the users password with the request? (Ideally, I'd like to do so using OAuth as suggested here.) Am I misunderstanding something?
Please excuse me if I'm missing something obvious, here. I'm pretty new to both Google App Engine and XMPP. Unlike a lot of examples I've found online, I don't want to create a chat "robot"; I merely want to change an existing user's Google Talk status. Thanks in advance for any pointers!

You can't change someone else' status using the XMPP API.
You can use the XMPP API to represent yourself, or your users (see the description of XMPP addresses in the GAE XMPP API docs).
You cannot send messages or update the status of a gmail user.

Related

Google Calendar Api Documentation better than the official V3

Please I want to create Event in Google Calendar API but the documentation official is BAD I cant use it .. And someone here who can help me please!! Sorry with my english but I speak spanish!
I agree...
This helps a bit: Google Calendar Events
Depending on the process you are using, there are few examples for using asp.net and the service account option. I successfully created events via service account with granting domain-wide access. With this you just need to create an app, then service account for the app and follow the domain wide delegation steps on the google documentation pages. This option is great if you have an app that needs to create events without having to authenticate the user.
For working code and more info you can see what I used at-
Google API Calender v3 Event Insert via Service Account using Asp.Net MVC
What is "bad" about the documentation? (Don't just complain; provide actionable feedback.) In the v3 docs, check out the reference section on creating events. There is even sample code in Java, Python, PHP, and Ruby to help get you started just below the reference. In addition, below the sample code is the APIs Explorer where you can issue requests with appropriate payload to the API and see the HTTP response to ensure you're calling the API correctly and receiving the data you requested. If there's any additional way for us to improve the docs, please let us know!
UPDATE (Sep 2015): I created a blogpost and video that walks through some pseudocode (well, it's Python) for creating events. There are examples in most other languages too.

Using google API's from Appengine (OAuth)

I want to use Google Prediction from a Python Google App Engine Application. Google Prediction requires you to store your "prediction models" in Google Storage for Developers, in effect meaning that to use GP you must use GSD. Unfortunately, both GP and GSD seem to require OAuth 2.0 .
This Oauth stuff is really getting in the way though! All the examples I find seem to deal with the case of wanting for access a users data/credentials/identity/whatever using Oauth. I have no need for that. I simply want to access a resource (GP and GSD) from my server using http request. Repeat, I just want to use some of their services, I have no need at all to access any other users information!
I can see from my Google API console that I have created both a id and secret for my GAE applications domain. Is it not possible to just use these values to do OAuth authentication to other Google API's? Effectively saying "I am the application at domain xyz, here are my credentials, let me use your API"? It seems kind of ridiculous that Google is currently forcing people to use such a burdensome authentication system for things that they are trying to get people to try out?
I am hoping there is some magical awesome library that will take care of all these OAuth details for me. Short of that, a code example of how to do these things in Python App Engine would be useful. I just want to use the Google Prediction and Google Storage for Developers services from my python GAE app, but I am blocked by the burden of having to configure all of this OAuth stuff. Isn't there some easy way to do this?
Look at the Google API Python Client. You should just be able to put your tokens in and connect. There are some examples on the page that should give you enough information to connect in.
I'm the Product Manager at Google working on the Prediction API. The first thing I want to say is thank you for trying out the API and for reaching out to the world about your issues! We hear you! We are very aware of the difficulty of using the API in some cases and some of the pain OAuth2.0 can cause for the simple use cases. In particular I tried to do exactly what you were doing a few weeks ago and was myself rather frustrated! We're working on it!
OK, so, that's all nice and dandy, but do I have anything helpful for you? Hopefully I do! I managed to get my GAE application working with GP -- I shelved the GSD component for the moment as I ran out of time, so hopefully somebody else can lend you some sample code for that (it should involve using boto & OAuth to handle the tricky bits).
from apiclient.discovery import build
from oauth2client.client import OAuth2Credentials
# You can find an example oauth2client in the python prediction sample code
# Replace everything in <>'s
credentials = OAuth2Credentials(
"<access_token>", #probably empty string
"<client_id>",
"<client_secret>",
"<refresh_token>",
<Expiry>, # Probably None
"https://accounts.google.com/o/oauth2/token",
"<app_useragent>")
http = credentials.authorize(httplib2.Http())
service = build("prediction", "v1.3", http=http)
You should be able to get the client id an client secret from the API console. You can use any sample application or demo, e.g. the python sample code, to generate a refresh token.
Best of luck! Feel free to followup directly with me (zg#google.com) or post to our public discussion list (prediction-api-discuss#googlegroups.com) if you still have any trouble.

Google App Engine Xmpp chat how to manage the status of the users?

It is easy to play with xmpp and the channel api to obtain a chat like...
http://www.dev-articles.com/article/Google-App-Engine-sending-messages-with-XMPP-393002
is an example, although I'm fighting a bit to understand the best way to manage the status of the users. Anyone with some experience about it?
I read the part "User Presence" in the documentation http://code.google.com/appengine/docs/java/xmpp/overview.html I still don't have a grasp of it...
Ok I think I know a bit more now, so this is how I manage the status of a xmpp account with google app appengine.
Xmpp status in app engine

How to implement RESTful API on an App Engine server with webapp ( +Facebook authentication )?

so my idea is pretty simple. But I don't know where to start.
develop a simple RESTful API on my app engine server using the simple webapp framework.
there will be two kinds of clients:
1. Normal pc users access the facebook application, and this will directly place API calls to my app engine server.
( Please note, that the facebook application itself is hosted on the same app engine server)
Iphone users access my app engine server by going though Facebook connect. The user is then free to make the API calls.
So how i checked the App3 Project at http://code.google.com/p/app3/, then didn't really have authentication in place.
Any suggestions/ideas?
I have a rough idea of how the flow works
Assumption: I have the datastore all set up with user data.
For normal PC users accessing my FB app:
--> authenticate in FB ->I save their userid + facebook_session_key in with gmemsess -> I use both data to authenticate with the user data in my datastore --> that user is now free to CRUD on my server.
For iphone users, it's the same flow. But with Facebook Connect.
the CRUD should look something like:
if the user wants to check his/her stats, the API call would be something like:
/rest/getstats
Is anyone actually doing something like that? I'd appreciate everyone's insights.
A simple, hassle free solution would be awesome!
Well, this might not be exactly what you've been looking for, but here's my try:
To do simple REST on app engine, you can try Jim Fulton's excellent library, bobo (here's a link to the REST section of the documentation). Bobo is a well-tested, simple package that contains only one fily, bobo.py, so it perfectly fits a minimalistic application's need. You can simply put it on top of webapp.
Note that the decorators shown in the documentation need to be converted to python2.5-style to work, so
#bobo.resource('/rest/getstats', 'GET')
def get_stats(self, request):
"Get user's stats"
would become
def get_stats(self, request):
"Get user's stats"
get_stats = bobo.resource('/rest/getstats', 'GET')(get_stats)
and such. This should be an easy approach to REST.
As for the authentication, you could pipe repoze.who into the WSGI pipeline. There are a some very simple repoze.who plugins for the facebook API out there in the wild (unfortunately none of them on pypi), I wrote a very simple one myself for a simple Facebook application a while ago. You can check it out here, along with a brief wiki and some dependency graphs that might help keep your app lightweight and memory-efficient. (Note on the dependency graphs there: some of the Zope libraries has been simplified since then; for Facebook authentication to work, you only need zope.interface.)
Maybe I didn't really give you anything specific (or useful), but these are just a few links you can take a look at, they might come in handy.

Grails App Engine Authentication

How do I setup Account Registration, Login, etc in Grails when developing for the Google App Engine? Normally I would use the Acegi plugin but I've read that it doesn't work with Google App Engine.
For reference, I'm using the Grails app-engine and gorm-jpa plugins.
Google App Engine allows you to manage users through their Google Accounts Java API. The page provides example codes which you can easily implement with Groovy.
Hope it helps.
You should take a look at this patch: http://jira.codehaus.org/browse/GRAILSPLUGINS-1233. I haven't used it yet but might be what you are after.
In my opinion, it is essential to create custom authentication instead of using Google Account API to create any viable application run on GAE.
So, I created my own solution to tackle this problem which you may interested to have a look at URL:
http://grailsfuse.vobject.com/
(You will hit http 500 error for first request, please wait for 30 seconds and refresh)
The missing part is the self-registration page and remember me feature. Please contact us (hyperlink located below the page of URL above) if you are still interested.
Wish to heard from you soon!

Resources