def api_client(manager): with Session() as session: user = session.query(User).first() if not user: user = User(name='flexget', password='******') session.add(user) session.commit() return APIClient(user.token)
def api_key(session=None): user = session.query(User).first() if not user: user = User(name='flexget', password='******') session.add(user) session.commit() return user.token