def create_game(self, request): """create a new game """ # look up initiating player slinger = Player.query(Player.player_id == request.player_id).get() if slinger is None: raise endpoints.BadRequestException( 'specified player_id not found') # generate new game game_id = uniq_id() game = Game(game_id=game_id, player_id=slinger.player_id) game.put() # create game history for this game history = History(game=game.key) history.put() return game.to_message()
def create_player(self, request): """Create a Player. Optionally set a (non)unique username and email (not validated)""" # LATER: filter using bleach and profanity pip libs to prevent XSS and xbox live community # LATER: include funny response when popular slinger names are chosen email = None if request.email is not None: email = request.email player_name = None if request.desired_name is not None: player_name = request.desired_name player_id = uniq_id() player = Player(player_id=player_id, player_name=player_name, player_email=email) player.put() return player.to_message()
def __init__(self): self.bs = 32 self.crypt_key = uniq_id()
def start(self): session_id = uniq_id() open('../tmp/session_%s.py' % session_id, 'w') return session_id
def start(self): session_id = uniq_id() open("../tmp/session_%s.py" % session_id, "w") return session_id