from onevone.db_manager import DBManager from onevone import log from flask import Flask app = Flask(__name__) app.config.from_object('onevone.configuration.DevelopmentConfig') DBManager.init(app.config['DATABASE_URI']) from onevone import urls
def decorator(*args, **kwargs): cache_key = self.key_format.format(*args, **kwargs) ret = cache.get(cache_key) if ret is None: ret = f(*args, **kwargs) if ret is not None: cache.set(cache_key, json.dumps(ret)) if self.timeout > 0: cache.expire(cache_key, self.timeout) return ret return json.loads(ret.decode('utf-8')) return decorator DBManager.init(os.environ['ONEVONE_PRODUCTION_DB']) RIOT_GLOBAL_API = 'https://global.api.pvp.net/api/lol' RIOT_API_KEY = os.environ['RIOT_API_KEY'] api_versions = { 'static': 'v1.2', 'matchlist': 'v2.2', 'league': 'v2.5', 'match': 'v2.2', } xy_version_regex = r'^((?:\d+\.*){2})((?:\.\d*)*)$' xyz_version_regex = r'^((?:\d+\.*){3})((?:\.\d*)*)$' static_url = '{0}/static-data/eune/{1}'.format(RIOT_GLOBAL_API, api_versions['static']) riot_static_api = RESTClient(base_url=static_url, log=log) riot_api = RESTClient(log=log)