Пример #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)
def seed():
    return seeds.run()
Пример #4
0
def pattern():
    with app.app_context():
        mongo.db.operations.drop()
        seeds.run()
Пример #5
0
def handle_round_table():
    seeds.run()
    return 'seeds ran'
Пример #6
0
def seed():
    print('Seeding data...')
    run()
Пример #7
0
def pop_data():
    return seeds.run()
Пример #8
0
def reset_database():
    seeds.run()
    return 'seeds ran'