# Path: data_model.py
# class PhoneLog(db.Model):
#   phone       = db.StringProperty()
#   to          = db.StringProperty(multiline=True)
#   date        = db.DateTimeProperty(auto_now_add=True)
#   body        = db.StringProperty(multiline=True,indexed=False)
#   smsID       = db.StringProperty(indexed=False)
#   outboundSMS = db.StringProperty(multiline=True,indexed=False)
# 
# Path: data_model.py
# class Caller(db.Model):
# 	# caller's phone number requests are sent from
# 	phone   = db.StringProperty(indexed=True)
#     # the SMB service number Caller has permission to use
# 	service = db.StringProperty()
# 	
# 	created = db.DateProperty(auto_now_add=True)
# 	expires = db.DateProperty()


import os
import logging
import webapp2
import twilio
import config
import paywall
from operator import itemgetter
from datetime import date
from datetime import timedelta
from google.appengine.api.labs.taskqueue import Task
from google.appengine.ext import db
from google.appengine.ext.webapp import template
from data_model import PhoneLog
from data_model import Caller
               'To'   : friend.phone,
               'Body' : self.request.get('text'),
               }
        try:
            account.request('/%s/Accounts/%s/SMS/Messages' % (config.API_VERSION, config.ACCOUNT_SID),
                            'POST', sms)
        except Exception, e:
            logging.error("Twilio REST error: %s" % e)


      self.response.out.write('success');

## end

class AdminHandler(webapp2.RequestHandler):
    def get(self):
      user = users.get_current_user()
      if user and users.is_current_user_admin():
          greeting = ("Welcome, %s! (<a href=\"%s\">sign out</a>)" %
                      (user.nickname(), users.create_logout_url("/")))
      else:
          greeting = ("<a href=\"%s\">Sign in</a>." %
                        users.create_login_url("/"))

      # do some analysis on the request history...
      total = 0
      callers = dict()
      reqs = dict()
      cursor = None
      # Start a query for all Person entities.

# Path: data_model.py
# class PhoneLog(db.Model):
#   phone       = db.StringProperty()
#   to          = db.StringProperty(multiline=True)
#   date        = db.DateTimeProperty(auto_now_add=True)
#   body        = db.StringProperty(multiline=True,indexed=False)
#   smsID       = db.StringProperty(indexed=False)
#   outboundSMS = db.StringProperty(multiline=True,indexed=False)
# 
# Path: data_model.py
# class Caller(db.Model):
# 	# caller's phone number requests are sent from
# 	phone   = db.StringProperty(indexed=True)
#     # the SMB service number Caller has permission to use
# 	service = db.StringProperty()
# 	
# 	created = db.DateProperty(auto_now_add=True)
# 	expires = db.DateProperty()


# Path: admin.py
import os
import logging
import webapp2
import twilio
import config
import paywall
from operator import itemgetter
from datetime import date
from datetime import timedelta
from google.appengine.api.labs.taskqueue import Task
from google.appengine.ext import db
from google.appengine.ext.webapp import template
from data_model import PhoneLog
from data_model import Caller

               'To'   : friend.phone,
               'Body' : self.request.get('text'),
               }
        try:
            account.request('/%s/Accounts/%s/SMS/Messages' % (config.API_VERSION, config.ACCOUNT_SID),
                            'POST', sms)
        except Exception, e:
            logging.error("Twilio REST error: %s" % e)


      self.response.out.write('success');

## end

class AdminHandler(webapp2.RequestHandler):
    def get(self):
      user = users.get_current_user()
      if user and users.is_current_user_admin():
          greeting = ("Welcome, %s! (<a href=\"%s\">sign out</a>)" %
                      (user.nickname(), users.create_logout_url("/")))
      else:
          greeting = ("<a href=\"%s\">Sign in</a>." %
                        users.create_login_url("/"))

      # do some analysis on the request history...
      total = 0
      callers = dict()
      reqs = dict()
      cursor = None
      # Start a query for all Person entities.

      q = PhoneLog.all()