Пример #1
0
    def AddUserToken(self, token):
        client = Client(token)
        athlete = client.get_athlete()

        # Simplified logic not to add duplicate user tokens.
        # todo: check the user is not in the user token table.
        if self.GetMemcacheToken(athlete.id) is None:
            rider = UserToken(strava_id=athlete.id, strava_token=token)
            rider.put()

            memcache.add(self.GetMemcacheKey(athlete.id), token, 60)

        return athlete.id