# Path: data_model.py
# class DeveloperRequest(db.Model):
#     developer     = db.ReferenceProperty()
#     date          = db.DateTimeProperty(auto_now_add=True)
#     type          = db.StringProperty()
#     error         = db.StringProperty()
#     requestTerms  = db.StringProperty()
#     remoteAddr    = db.StringProperty()


import logging
import re
import datetime
import json
from pytz.gae import pytz
from google.appengine.api import memcache
from google.appengine.ext import db
from google.appengine.datastore import entity_pb
from data_model import DeveloperRequest

    return directionLabel

## end getDirectionLabel()

def handle_500(request, response, exception):
    logging.error('Server ERROR :: %s' % exception)
    callback = request.get('callback')
    if callback is not '':
        response.headers['Content-Type'] = 'application/javascript'
        response.headers['Access-Control-Allow-Origin'] = '*'
        response.headers['Access-Control-Allow-Methods'] = 'GET'
    else:
        response.headers['Content-Type'] = 'application/json'

    response.out.write(json.dumps(buildErrorResponse("-1","Internal server error")))


GETARRIVALS = "get arrivals"
GETVEHICLES = "get vehicles"
GETSTOPS = "get stops"
GETROUTES = "get routes"
GETNEARBYSTOPS = "get nearby stops"
GETSTOPLOCATION = "get stop location"

def recordDeveloperRequest(devKey,type,terms,ipaddr,error='success'):

    # this is too damn expensive to store all of these on app engine
    # so we're going to ignore these requests
    if False:

# Path: data_model.py
# class DeveloperRequest(db.Model):
#     developer     = db.ReferenceProperty()
#     date          = db.DateTimeProperty(auto_now_add=True)
#     type          = db.StringProperty()
#     error         = db.StringProperty()
#     requestTerms  = db.StringProperty()
#     remoteAddr    = db.StringProperty()


# Path: api/v1/api_utils.py
import logging
import re
import datetime
import json
from pytz.gae import pytz
from google.appengine.api import memcache
from google.appengine.ext import db
from google.appengine.datastore import entity_pb
from data_model import DeveloperRequest


    return directionLabel

## end getDirectionLabel()

def handle_500(request, response, exception):
    logging.error('Server ERROR :: %s' % exception)
    callback = request.get('callback')
    if callback is not '':
        response.headers['Content-Type'] = 'application/javascript'
        response.headers['Access-Control-Allow-Origin'] = '*'
        response.headers['Access-Control-Allow-Methods'] = 'GET'
    else:
        response.headers['Content-Type'] = 'application/json'

    response.out.write(json.dumps(buildErrorResponse("-1","Internal server error")))


GETARRIVALS = "get arrivals"
GETVEHICLES = "get vehicles"
GETSTOPS = "get stops"
GETROUTES = "get routes"
GETNEARBYSTOPS = "get nearby stops"
GETSTOPLOCATION = "get stop location"

def recordDeveloperRequest(devKey,type,terms,ipaddr,error='success'):

    # this is too damn expensive to store all of these on app engine
    # so we're going to ignore these requests
    if False:

      req = DeveloperRequest()