Source

GtugGoSandbox / mapgame / action.py

from google.appengine.ext import webapp
from google.appengine.api import user
from google.appengine.ext.webapp.util import run_wsgi_app
from django.utils import simplejson as json
from models import Player
from models import Location
from random import *


class Action(webapp.RequestHandler):
    def post(self):
        u = user.get_current_user()
        player1 = {'player':u.email,'hp':random.randint()}   
        player2 = {'player':self.request.get('opponent'),
                   'hp':random.randint()}
        result = [player1,player2]
        self.response.out.write(json.loads(result))