Ejemplo n.º 1
0
from models import db, aggregate_stats, log_call, call_count
from political_data import PoliticalData

app = Flask(__name__)

app.config.from_object('config.ConfigProduction')

cache = Cache(app, config={'CACHE_TYPE': 'simple'})
sentry = Sentry(app)

db.init_app(app)

call_methods = ['GET', 'POST']

data = PoliticalData()


def make_cache_key(*args, **kwargs):
    path = request.path
    args = str(hash(frozenset(request.args.items())))

    return (path + args).encode('utf-8')


def play_or_say(resp_or_gather, msg_template, **kwds):
    # take twilio response and play or say a mesage
    # can use mustache templates to render keword arguments
    msg = pystache.render(msg_template, kwds)

    if msg.startswith('http'):
Ejemplo n.º 2
0
 def setUp(self):
     self.data = PoliticalData()
Ejemplo n.º 3
0
cache = Cache(app, config={'CACHE_TYPE': 'simple'})
sentry = Sentry(app)

# db.init_app(app) # JL HACK ~ disable mysql

# Optional Redis cache, for caching Google spreadsheet campaign overrides
cache_handler = CacheHandler(app.config['REDIS_URL'])

# FFTF Leaderboard handler. Only used if FFTF Leadboard params are passed in
leaderboard = FFTFLeaderboard(app.debug, app.config['FFTF_LB_ASYNC_POOL_SIZE'],
                              app.config['FFTF_CALL_LOG_API_KEY'])

call_methods = ['GET', 'POST']

data = PoliticalData(cache_handler, app.debug)

print "Call Congress is starting up!"


def make_cache_key(*args, **kwargs):
    path = request.path
    args = str(hash(frozenset(request.args.items())))

    return (path + args).encode('utf-8')


def play_or_say(resp_or_gather, msg_template, **kwds):
    # take twilio response and play or say a mesage
    # can use mustache templates to render keyword arguments
    msg = pystache.render(msg_template, kwds)