from passlib.hash import sha256_crypt from flask_login import login_required, current_user from flask import request, render_template, g, flash, redirect, url_for, session from flask_jwt_extended import get_jti from onyxbabel import gettext from onyx.extensions import login_manager, db from onyx.decorators import admin_required from onyx.api.assets import Json from onyx.api.events import Event from onyx.api.token import Token from onyx.api.user import User from onyx.util import getLogger from onyx.api.exceptions import * from . import auth logger = getLogger('Auth') event = Event() token_api = Token() json = Json() user = User() @login_manager.user_loader def load_user(id): db.session.rollback() return UsersModel.User.query.get(int(id)) #Hello Home route @auth.route('hello') def hello(): return render_template('account/hello.html', next=request.args.get('next'))
http://creativecommons.org/licenses/by-nc-sa/3.0/fr/ You may not use this software for commercial purposes. @author :: Cassim Khouani """ from onyx.api.exceptions import * from onyx.api.assets import Json from onyx.extensions import db from onyx.core.models import * from flask import g, current_app as app from onyx.skills.core import * from onyx.util import getLogger import onyx import os json = Json() logger = getLogger('Widgets') class Widgets: def __init__(self): self.id = None self.url = None self.user = None self.color = None self.name = None self.see_more = None self.plugin_name = None def get(self): try: query = WidgetsModel.Widget.query.filter_by(user=self.user).all()
# -*- coding: utf-8 -*- """ Onyx Project http://onyxproject.fr Software under licence Creative Commons 3.0 France http://creativecommons.org/licenses/by-nc-sa/3.0/fr/ You may not use this software for commercial purposes. @author :: Cassim Khouani """ from onyx.api.assets import Json import wikipedia from onyx.util import getLogger from onyx.api.exceptions import * logger = getLogger('Wikipedia') json = Json() class Wikipedia: def __init__(self): self.lang = None self.search = None def get_article(self): try: wikipedia.set_lang(self.lang) article = wikipedia.page(self.search) return article except Exception as e: logger.error('Getting wiki article error : ' + str(e)) raise WikiException(str(e))
@author :: Cassim Khouani """ from onyx.api.exceptions import * from onyx.api.assets import Json from flask_login import current_user from onyxbabel import gettext from onyx.extensions import db from onyx.core.models import * from flask import g, current_app as app from onyx.skills.core import * from onyx.util import getLogger import onyx import os json = Json() logger = getLogger('Widgets') class Widgets: def __init__(self): self.id = None self.url = None self.user = None self.color = None self.name = None self.see_more = None self.plugin_name = None def get(self): try: query = WidgetsModel.Widget.query.filter_by(user=current_user.id).all()
from onyx.api.widgets import * from onyx.api.scenario import * from onyx.api.navbar import * from onyx.api.assets import Json from onyx.api.exceptions import * from onyx.util import getLogger from onyx.skills.core import get_skill_function #from onyx.api.kernel import Kernel from onyx.config import get_config import subprocess scenario = Scenario() widgets = Widgets() navbar = Navbar() logger = getLogger("Skill") #kernel = Kernel() json = Json() config = get_config('onyx') class Skill: def __init__(self): self.name = None self.url = None self.config = config self.app = app def get(self): try:
""" Onyx Project http://onyxproject.fr Software under licence Creative Commons 3.0 France http://creativecommons.org/licenses/by-nc-sa/3.0/fr/ You may not use this software for commercial purposes. @author :: Cassim Khouani """ from onyx.api.geolocalisation import Geolocalisation from onyx.api.exceptions import * from onyx.api.assets import Json from onyxbabel import gettext from onyx.util import getLogger json = Json() logger = getLogger('Weather') class Weather: def __init__(self): self.latitude = None self.longitude = None def get_str(self): try: geoloc = Geolocalisation() self.latitude = geoloc.get_latitude() self.longitude = geoloc.get_longitude() json.url = "http://api.openweathermap.org/data/2.5/forecast/daily?lat=" + str(self.latitude) + "&lon=" + str(self.longitude) + "&cnt=14&mode=json&units=metric&lang=fr&appid=184b6f0b48a04263c59b93aee56c4d69" result = json.decode_url() return gettext('It is ') + str(round(result["list"][0]["temp"]["day"])) + gettext(" ° in ") + str(result["city"]["name"]) + " !"
# -*- coding: utf-8 -*- """ Onyx Project https://onyxlabs.fr Software under licence Creative Commons 3.0 France http://creativecommons.org/licenses/by-nc-sa/3.0/fr/ You may not use this software for commercial purposes. @author :: Cassim Khouani """ import wikipedia from onyx.api.assets import Json from onyx.util import getLogger from onyx.api.exceptions import * logger = getLogger('Wikipedia') json = Json() class Wikipedia: def __init__(self): self.lang = None self.search = None def get_article(self): try: wikipedia.set_lang(self.lang) article = wikipedia.page(self.search) return article except Exception as e:
""" Onyx Project https://onyxlabs.fr Software under licence Creative Commons 3.0 France http://creativecommons.org/licenses/by-nc-sa/3.0/fr/ You may not use this software for commercial purposes. @author :: Cassim Khouani """ from onyx.api.exceptions import * from onyx.api.assets import Json from onyx.extensions import db from onyx.core.models import * from onyx.util import getLogger json = Json() logger = getLogger('Weather') class Weather: def __init__(self): self.latitude = None self.longitude = None self.token = None def set_token(self): try: query = ConfigModel.Config.query.filter_by(config="weather_api").first() if query == None: add = ConfigModel.Config(config="weather_api", value=self.token)
import onyx, pip, os, git, shutil from onyx.api.widgets import * from onyx.api.scenario import * from onyx.api.navbar import * from onyx.api.assets import Json from onyx.api.exceptions import * from onyx.util import getLogger from onyx.skills.core import get_skill_function from onyx.api.kernel import Kernel import subprocess scenario = Scenario() widgets = Widgets() navbar = Navbar() logger = getLogger(__name__) kernel = Kernel() json = Json() from onyx.config import get_config config = get_config('onyx') class Skill: def __init__(self): self.name = None self.url = None self.config = config self.app = app def get(self):