예제 #1
0
 def __init__(self):
     """
     Crea el cliente para el conexion a pusher
     """
     self.client = pusher.Pusher(app_id=PUSHER_APP_ID,
                                 key=PUSHER_APP_KEY,
                                 secret=PUSHER_APP_SECRET,
                                 ssl=PUSHER_APP_SSL)
예제 #2
0
from flask import Flask, render_template, request, jsonify, make_response, json
from flask_cors import CORS
from pusher import pusher
import simplejson

app = Flask(__name__)
cors = CORS(app)
app.config['CORSHEADERS'] = 'Content-Type'

# configure pusher object
pusher = pusher.Pusher(
  app_id='633327',
  key='ef02df21659fe3e6bd52',
  secret='03443b79b61dc075b72d',
  cluster='ap3',
  ssl=True
)

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/admin')
def admin():
    return render_template('admin.html')

@app.route('/new/guest', methods=['POST'])
def guestUser():
    data = request.json
    pusher.trigger(u'general-channel', u'new-guest-details', { 
        'name' : data['name'], 
예제 #3
0
from flask import Flask, render_template, request, jsonify, make_response, json
from flask_cors import CORS
from pusher import pusher
import simplejson

app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'

pusher = pusher_client = pusher.Pusher(app_id='810024',
                                       key='68973a6fc5c4c16b3f3e',
                                       secret='6fae6cbdb1841db45662',
                                       cluster='ap1',
                                       ssl=True)


@app.route('/')
def index():

    return render_template('index.html')


@app.route('/admin')
def admin():
    return render_template('admin.html')


@app.route('/new/guest', methods=['POST'])
def guestUser():
    data = request.json
import json
from flask_cors import CORS
from pusher import pusher
import simplejson

app = Flask(__name__)

app.config['SECRET_KEY'] = '5791628bb0b13ce0c676dfde280ba245'
app.config[
    'SQLALCHEMY_DATABASE_URI'] = 'postgres://*****:*****@ec2-3-210-23-22.compute-1.amazonaws.com:5432/d33g4onqiumn8h'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
pusher = pusher.Pusher(app_id="1134388",
                       key="a60f02f7bde182f427ce",
                       secret="f42daac6390680efc75f",
                       cluster="ap2",
                       ssl=True)
api = Api(app)
db = SQLAlchemy(app)
migrate = Migrate(app, db)
parser = reqparse.RequestParser()


class UserInformation(db.Model, UserMixin):
    __tablename__ = 'App_students'

    student_id = db.Column(db.Integer, primary_key=True)
    student_name = db.Column(db.String())
    student_email = db.Column(db.Text())
    student_phone = db.Column(db.Integer)
예제 #5
0
from flask import Flask, render_template, request, jsonify, make_response, json
from flask_cors import CORS
from pusher import pusher
import simplejson

app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'


pusher = pusher_client = pusher.Pusher(
  app_id='PUSHER_APP_ID',
  key='PUSHER_APP_KEY',
  secret='PUSHER_APP_SECRET',
  cluster='PUSHER_APP_CLUSTER',
  ssl=True
)

@app.route('/')
def index():

	return render_template('index.html')

@app.route('/admin')
def admin():
	return render_template('admin.html')

@app.route('/new/guest', methods=['POST'])
def guestUser():
	data = request.json
예제 #6
0
파일: app.py 프로젝트: jtc10005/ChatWidget
from flask import Flask, render_template, request, jsonify, make_response, json
from flask_cors import CORS
from pusher import pusher
import simplejson

app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'

# configure pusher object
pusher = pusher.Pusher(
    app_id="573699",
    key="0f67f7766a7843b28d5c",
    secret="5a70f780483a16538bea",
    cluster="us2",
    ssl=True)


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/admin')
def admin():
    return render_template('admin.html')


@app.route('/new/guest', methods=['POST'])
def guestUser():
    data = request.json
예제 #7
0
from flask import Flask, render_template, request, jsonify, make_response, json
from pusher import pusher

app = Flask(__name__)

pusher = pusher_client = pusher.Pusher(app_id='935787',
                                       key='bfc1d239c66ec2226f11',
                                       secret='e783b27f787e04242990',
                                       cluster='eu',
                                       ssl=True)

name = ''


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/BriefingandConsent')
def BriefingandConsent():
    return render_template('BriefingandConsent.html')


@app.route('/play')
def play():
    global name
    name = request.args.get('username')
    return render_template('play.html')

예제 #8
0
from flask import Flask, render_template, request, jsonify, makeresponse, json
from flaskcors import CORS
from pusher import pusher
import simplejson

app = Flask(__name__)
cors = CORS(app)
app.config['CORSHEADERS'] = 'Content-Type'

# configure pusher object
pusher = pusher.Pusher(app_id='676121',
                       key='3f39c7f18f8b0db75beb',
                       secret='a831c0e5ff7ca7a93136',
                       cluster='us2',
                       ssl=True)


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/admin')
def admin():
    return render_template('admin.html')


@app.route('/new/guest', methods=['POST'])
def guestUser():
    data = request.json
    pusher.trigger(u'general-channel', u'new-guest-details', {
예제 #9
0
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt 
from pusher import pusher
from django.http import JsonResponse
from decouple import config
from django.contrib.auth.models import User
from .models import *
from rest_framework.decorators import api_view
import json

# instantiate pusher
channels_client = pusher.Pusher(
  app_id='851543',
  key='7ebdd8f48dea5a2b9254',
  secret='28f576b1fa100d60ef60',
  cluster='us3',
  ssl=True
)

@csrf_exempt
@api_view(["GET"])
def initialize(request):
    user = request.user
    player = user.player
    player_id = player.id
    uuid = player.uuid
    room = player.room()
    players = room.playerNames(player_id)
    return JsonResponse({'uuid': uuid, 'name':player.user.username, 'title':room.title, 'description':room.description, 'players':players}, safe=True)

@api_view(["GET"])
예제 #10
0
#File: ./app.py
from flask import Flask, render_template, request, jsonify, make_response, json
from pusher import pusher

app = Flask(__name__)

import pusher

pusher_client = pusher.Pusher(app_id='960032',
                              key='bc5c21a8a4fc2990fe4a',
                              secret='8ee5b28ecc6d94779c91',
                              cluster='us3',
                              ssl=True)

pusher_client.trigger('my-channel', 'my-event', {'message': 'hello world'})

name = ''


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/play')
def play():
    global name
    name = request.args.get('username')
    return render_template('play.html')

예제 #11
0
from flask import Flask, render_template, request, jsonify, makeresponse, json
from flaskcors import CORS
from pusher import pusher
import simplejson

app = Flask(_**name**_)

cors = CORS(app)

app.config_[_'CORSHEADERS'] = 'Content-Type'

pusher = pusher.Pusher(
    app_id = 'PUSHER_APP_ID'

    key = 'PUSHER_APP_KEY'
    secret = 'PUSHER_APP_SECRET'
    cluster = 'PUSHER_APP_CLUSTER'

    ssl = True
)

@app.route('/')
def index():
    return render_template('index.html')


#admin control
@app.route('/admin')
def admin():
    return render_template('admin.html')
예제 #12
0
from flask import Flask, render_template, request, jsonify, make_response, json
from flask_cors import CORS
from pusher import pusher
import simplejson

app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'

# configure pusher object CHANGE BEFORE PUSHING
pusher = pusher.Pusher(app_id='595061',
                       key='22309693aff78e2d1a24',
                       secret='75d320c6b0cd6193ee57',
                       cluster='us2',
                       ssl=True)


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/admin')
def admin():
    return render_template('admin.html')


@app.route('/new/guest', methods=['POST'])
def guestUser():
    data = request.json
    pusher.trigger(u'general-channel', u'new-guest-details', {
예제 #13
0
from flask import Flask, render_template, request, json
from pusher import pusher

app = Flask(__name__)

pusher = pusher.Pusher(
    app_id='928597',
    key='9d5365f81a0e2a336b50',
    secret='765aaf248e0ed58ccc1f',
    cluster='us2',
    ssl=True,
)

name = ''


@app.route('/')
@app.route('/login')
def login():
    return render_template('login.html')


@app.route('/bargaining')
def bargaining():
    global name
    name = request.args.get('username')
    return render_template('bargaining.html')


@app.route("/pusher/auth", methods=['POST'])
def pusher_authentication():
예제 #14
0
from flask import Flask, render_template, request, jsonify, make_response, json
from flask_cors import CORS
from pusher import pusher
import simplejson

app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'

# configure pusher object
pusher = pusher.Pusher(app_id="754826",
                       key="c8cf2906ac8f38374788",
                       secret="74be11bf2cec560b5920",
                       cluster="us2",
                       ssl=True)


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/admin')
def admin():
    return render_template('admin.html')


@app.route('/new/guest', methods=['POST'])
def guestUser():
    data = request.json
    pusher.trigger(u'general-channel', u'new-guest-details', {
예제 #15
0
from flask import Flask, render_template, request, jsonify, make_response, json
from pusher import pusher

app = Flask(__name__)

pusher = pusher_client = pusher.Pusher(app_id='1061305',
                                       key='d26ffd26a4492e1f9afe',
                                       secret='3aca0a191847373f4edf',
                                       cluster='eu',
                                       ssl=True)

name = ''


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/play')
def play():
    global name
    name = request.args.get('username')
    return render_template('play.html')


@app.route("/pusher/auth", methods=['POST'])
def pusher_authentication():
    auth = pusher.authenticate(channel=request.form['channel_name'],
                               socket_id=request.form['socket_id'],
                               custom_data={
예제 #16
0
from flask import Flask, render_template, request, jsonify, make_response, json
from flask_cors import CORS
from pusher import pusher
import simplejson

app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'

pusher = pusher.Pusher(app_id="APP ID DO PUSHER",
                       key="CHAVE DA CONTA PUSHER",
                       secret="SEGREDO DO PROJETO PUSHER",
                       cluster="us2",
                       ssl=True)


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/admin')
def admin():
    return render_template('admin.html')


@app.route('/new/guest', methods=['POST'])
def guestUser():
    data = request.json
    pusher.trigger(u'general-channel', u'new-guest-details', {
        'name': data['name'],
예제 #17
0
import os
from flask import Flask, render_template
from . import settings, controllers, chat
from .extensions import db
from .settings import SECRET_KEY
from pusher import pusher
from flask_cors import CORS
import simplejson

project_dir = os.path.dirname(os.path.abspath(__file__))

pusher = pusher.Pusher(app_id="1067591",
                       key="f52f5c0ac5302815fdd1",
                       secret="bbc90254989765f3b7a0",
                       cluster="ap2",
                       ssl=True)


def create_app(config_object=settings):
    app = Flask(__name__, instance_relative_config=True)
    app.config.from_object(config_object)
    app.secret_key = SECRET_KEY
    cors = CORS(app)
    #    register_extensions(app)
    register_extensions(app)
    register_blueprints(app)
    register_errorhandlers(app)

    return app

예제 #18
0
app = Flask(__name__)


app.config["MONGO_DBNAME"] = "myTestDB"
app.config["MONGO_URI"] = os.environ.get("MONGO_URI")
app.config['CORS_HEADERS'] = 'Content-Type'
app.secret_key = os.environ.get("SECRET_KEY")
Cloud.config.update = ({
    'cloud_name': os.environ.get('CLOUDINARY_CLOUD_NAME'),
    'api_key': os.environ.get('CLOUDINARY_API_KEY'),
    'api_secret': os.environ.get('CLOUDINARY_API_SECRET')
})
pusher = pusher.Pusher(
    app_id=os.environ.get('APP_ID'),
    key=os.environ.get('KEY'),
    secret=os.environ.get('SECRET'),
    cluster=os.environ.get('CLUSTER'),
    ssl=True)

mongo = PyMongo(app)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'


@app.route('/')
@app.route('/homepage')
def homepage():
    return render_template('homepage.html')


# Contact page
예제 #19
0
import translate, sentiment, synthesize
from flask import Flask, render_template, request, jsonify, make_response, json
from flask_cors import CORS
from pusher import pusher
import os, requests, uuid, json
import simplejson

app = Flask(__name__)
app.config['JSON_AS_ASCII'] = False
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'

# configure pusher object
pusher = pusher.Pusher(app_id='973411',
                       key='f7de384babef4471a3bc',
                       secret='aaa0da5ac23a94694f34',
                       cluster='us2',
                       ssl=True)


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/admin')
def admin():
    return render_template('admin.html')


@app.route('/translate-text', methods=['POST'])
예제 #20
0
from flask import Flask,render_template,request,jsonify,json
from flask_cors import CORS
from pusher import pusher
import simplejson

app=Flask(__name__)
cors=CORS(app)
app.config['CORSHEADERS']='Content-Type'

pusher = pusher.Pusher(
    app_id='880565',
    key='5b11297234df431aeca4',
    secret='2119845d9a5739d99d0f',
    cluster='mt1',
    ssl=True)

@app.route('/')
def index():
	return render_template('index.html')

@app.route('/admin')
def admin():
	return render_template('admin.html')

@app.route('/new/guest',methods=['POST'])
def guestUser():
	data=request.json
	pusher.trigger(u'general-channel',u'new-guest-details',{
		'name':data['name'],
		'email':data['email']
		})
예제 #21
0
from flask import Flask, render_template, request, jsonify, make_response, json
from flask_cors import CORS
from pusher import pusher
import simplejson

app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'

# configure pusher object
pusher = pusher.Pusher(
    app_id='574024',
    key='',  # hidden
    secret='',  # hidden
    cluster='us2',
    ssl=True)


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/admin')
def admin():
    return render_template('admin.html')


@app.route('/new/guest', methods=['POST'])
def guestUser():
    data = request.json
예제 #22
0
from flask import Flask, render_template, request, jsonify, make_response, json, session, flash, redirect, url_for
from pusher import pusher
from flaskext.mysql import MySQL
from passlib.hash import sha256_crypt
from MySQLdb import escape_string as thwart
from functools import wraps
import os

app = Flask(__name__)
app.secret_key = os.urandom(24)
mysql = MySQL()

pusher = pusher_client = pusher.Pusher(app_id="625212",
                                       key="3e87945a40da57312dea",
                                       secret="a4422b546645ab786621",
                                       cluster="us2",
                                       ssl=True)

name = ''

# MySQL configurations
app.config['MYSQL_DATABASE_USER'] = '******'
app.config['MYSQL_DATABASE_DB'] = 'appdb'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
mysql.init_app(app)

conn = mysql.connect()
cursor = conn.cursor()


# function checks the session loggin in status to see if user is logged in, if not it redirects them to the login page
예제 #23
0
    Used for model receivers to trigger pusher signals for them
    """
    # Events for models with parties are structured
    if not channel and hasattr(instance, 'party'):
        channel = get_channel_name(instance.party.pk)

    # For model signals, we use PusherEventNameAffix
    event: str = ModelEventNameAffix.CREATE if created else ModelEventNameAffix.UPDATE
    if created is None:
        event = ModelEventNameAffix.DELETE

    # Add model as event name with event affix
    event = '{model}-{affix}'.format(model=instance.__class__.__name__, affix=event).lower()

    # If data is not given, set data to instance PK
    data = data if data else str(instance.pk)

    # Trigger a pusher
    pusher_client.trigger(channel, event, data)


# Initiate pusher client
if settings.PUSHER_APP_ID:
    pusher_client: Pusher = pusher.Pusher(
        app_id=settings.PUSHER_APP_ID,
        key=settings.PUSHER_KEY,
        secret=settings.PUSHER_SECRET,
        cluster=settings.PUSHER_CLUSTER,
        ssl=settings.PUSHER_SSL,
    )
예제 #24
0
from flask import Flask, render_template, request, jsonify, make_response, json
from flask_cors import CORS
from pusher import pusher
import simplejson

app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'

pusher = pusher_client = pusher.Pusher(app_id='1073615',
                                       key='031a5f6199801fa8d257',
                                       secret='2ecb1d3316963c714f8c',
                                       cluster='us2',
                                       ssl=True)


@app.route('/')
def index():

    return render_template('index.html')


@app.route('/admin')
def admin():
    return render_template('admin.html')


@app.route('/new/guest', methods=['POST'])
def guestUser():
    data = request.json
예제 #25
0
# import simplejson

app = Flask(__name__)
cors = CORS(app)

app.config["CORS_HEADERS"] = "Content-Type"

PUSHER_APP_ID = os.environ["PUSHER_APP_ID"]
PUSHER_APP_KEY = os.environ["PUSHER_APP_KEY"]
PUSHER_APP_SECRET = os.environ["PUSHER_APP_SECRET"]

pusher = pusher_client = pusher.Pusher(
    app_id=PUSHER_APP_ID,
    key=PUSHER_APP_KEY,
    secret=PUSHER_APP_SECRET,
    cluster="eu",
    ssl=True,
)


@app.route("/")
def index():

    return render_template("index.html", PUSHER_APP_KEY=PUSHER_APP_KEY)


@app.route("/admin")
def admin():
    return render_template("admin.html", PUSHER_APP_KEY=PUSHER_APP_KEY)
예제 #26
0
from flask import Flask, render_template, request, jsonify, make_response, json
from flask_cors import CORS
from pusher import pusher
import simplejson
from config import pusher_config

app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'

# configure pusher object
pusher = pusher.Pusher(app_id=pusher_config['app_id'],
                       key=pusher_config['key'],
                       secret=pusher_config['secret'],
                       cluster=pusher_config['cluster'],
                       ssl=True)


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/admin')
def admin():
    return render_template('admin.html')


@app.route('/new/guest', methods=['POST'])
def guestUser():
    data = request.json
예제 #27
0
from flask import Flask, render_template, request, jsonify, make_response, json
from pusher import pusher
app = Flask(__name__)
pusher = pusher_client = pusher.Pusher(app_id="731422",
                                       key="b9b223d620af017d5dcb",
                                       secret="ed6545a9352a74b5c472",
                                       cluster="us3",
                                       ssl=True)
name = ''


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/play')
def play():
    global name
    name = request.args.get('username')
    return render_template('play.html')


@app.route("/pusher/auth", methods=['POST'])
def pusher_authentication():
    auth = pusher.authenticate(channel=request.form['channel_name'],
                               socket_id=request.form['socket_id'],
                               custom_data={
                                   u'user_id': name,
                                   u'user_info': {
                                       u'role': u'player'
예제 #28
0
]

cloudinary.config(cloud_name=os.getenv('CLOUD_NAME'),
                  api_key=os.getenv('API_KEY'),
                  api_secret=os.getenv('API_SECRET'))

PASSWORD_RESET_TIMEOUT_DAYS = 1

SCHEDULER_CONFIG = {
    "apscheduler.jobstores.default": {
        "class": "django_apscheduler.jobstores:DjangoJobStore"
    },
    'apscheduler.executors.processpool': {
        "type": "threadpool"
    },
}

SCHEDULER_AUTOSTART = True

pusher = pusher.Pusher(app_id=os.environ.get('PUSHER_APP_ID'),
                       key=os.environ.get('PUSHER_KEY'),
                       secret=os.environ.get('PUSHER_SECRET'),
                       cluster=os.environ.get('PUSHER_CLUSTER'),
                       ssl=True)

STOCK_JOB_TIME_INTERVAL = os.environ.get('STOCK_JOB_TIME_INTERVAL', '1440')
MOCK_AVERAGE_WEEKLY_SALES = int(
    os.environ.get('MOCK_AVERAGE_WEEKLY_SALES', '2'))

django_heroku.settings(locals())
예제 #29
0
from flask import Flask, render_template, request, jsonify, make_response, json
from flask_cors import CORS
from pusher import pusher
import simplejson

app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'

    # configure pusher object
pusher = pusher.Pusher(
app_id='575284',
key='4db55e0273c428b3f917',
secret='5d06e9170fd0c912290d',
cluster='ap1',
ssl=True)

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/admin')
def admin():
    return render_template('admin.html')

@app.route('/new/guest', methods=['POST'])
def guestUser():
    data = request.json
    pusher.trigger(u'general-channel', u'new-guest-details', { 
        'name' : data['name'], 
        'email' : data['email']
예제 #30
0
from flask import Flask, render_template, request, jsonify, make_response, json
from flask_cors import CORS
from pusher import pusher
import simplejson
import model

app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'

# configure pusher object
pusher_client = pusher.Pusher(app_id='992139',
                              key='31afc53fcb301efea29e',
                              secret='5c0e949cc67e54f5c2bf',
                              cluster='ap4',
                              ssl=True)

pusher_client.trigger('my-channel', 'my-event', {'message': 'hello world'})


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/admin')
def admin():
    return render_template('admin.html')


@app.route('/login/page')