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 }) })
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()
def pattern(): with app.app_context(): mongo.db.operations.drop() seeds.run()
def handle_round_table(): seeds.run() return 'seeds ran'
def seed(): print('Seeding data...') run()
def pop_data(): return seeds.run()
def reset_database(): seeds.run() return 'seeds ran'