コード例 #1
0
    def run_seeds():

        if get_jwt()['role'] != 'admin':
            raise APIException('Access denied', 403)

        seeds.run()

        lou = Profiles.query.filter_by(nickname='Lou').first()

        return jsonify({
            "1 Lou's id": lou.id,
            "2 token_data": {
                "id": lou.id,
                "role": "admin",
                "exp": 600000
            },
            "3 token": create_jwt({
                    'id': lou.id,
                    'role': 'admin',
                    'exp': 600000
                })
        })
コード例 #2
0
    def run_seeds(user_id, **kwargs):

        print(get_jwt())

        if get_jwt()['role'] != 'admin':
            raise APIException('Access denied', 403)
        print('running here')
        seeds.run()

        gabe = Profiles.query.filter_by(first_name='Gabriel').first()

        now = datetime.utcnow()
        # x['iat'] = now
        # x['nbf'] = now
        # x['sub'] = gabe.id
        # x['exp'] = now + timedelta(days=365)

        identity = {
            "id": gabe.id,
            "role": "admin",
            'sub': gabe.id,
            "exp": now + timedelta(days=365),
            'iat': now,
            'nbf': now
        }

        xx = jwt.encode(identity,
                        os.environ['JWT_SECRET_KEY'],
                        algorithm='HS256')

        return jsonify(
            {
                "1 Gabe's id": gabe.id,
                "2 token_data": identity,
                "3 token": xx
            }, 200)
コード例 #3
0
def seed():
    return seeds.run()
コード例 #4
0
def pattern():
    with app.app_context():
        mongo.db.operations.drop()
        seeds.run()
コード例 #5
0
ファイル: main.py プロジェクト: kolis10/flask-practice-2
def handle_round_table():
    seeds.run()
    return 'seeds ran'
コード例 #6
0
def seed():
    print('Seeding data...')
    run()
コード例 #7
0
ファイル: main.py プロジェクト: NDesprez001/Flask_SQL_Alchemy
def pop_data():
    return seeds.run()
コード例 #8
0
ファイル: main.py プロジェクト: hernanjkd/poker-society
def reset_database():
    seeds.run()
    return 'seeds ran'