Moving the cache instance to the PublicEndpoint class
parent
fe8466a309
commit
a4ecbae369
|
@ -6,7 +6,6 @@ from schematics.types import StringType, UUIDType
|
|||
|
||||
from selene.api import PublicEndpoint
|
||||
from selene.data.device import DeviceRepository
|
||||
from selene.util.cache import SeleneCache
|
||||
from selene.util.db import get_db_connection
|
||||
|
||||
|
||||
|
@ -21,7 +20,6 @@ class AccountDeviceEndpoint(PublicEndpoint):
|
|||
|
||||
def __init__(self):
|
||||
super(AccountDeviceEndpoint, self).__init__()
|
||||
self.cache: SeleneCache = self.config['SELENE_CACHE']
|
||||
self.device_pairing_time = 86400
|
||||
|
||||
def post(self, account_id):
|
||||
|
|
|
@ -8,7 +8,6 @@ from schematics.types import StringType
|
|||
|
||||
from selene.api import PublicEndpoint
|
||||
from selene.data.device import DeviceRepository
|
||||
from selene.util.cache import SeleneCache
|
||||
from selene.util.db import get_db_connection
|
||||
|
||||
|
||||
|
@ -27,7 +26,6 @@ class DeviceActivateEndpoint(PublicEndpoint):
|
|||
|
||||
def __init__(self):
|
||||
super(DeviceActivateEndpoint, self).__init__()
|
||||
self.cache: SeleneCache = self.config.get('SELENE_CACHE')
|
||||
self.sha512 = hashlib.sha512()
|
||||
|
||||
def post(self):
|
||||
|
|
|
@ -4,7 +4,6 @@ import random
|
|||
import uuid
|
||||
|
||||
from selene.api import PublicEndpoint
|
||||
from selene.util.cache import SeleneCache
|
||||
|
||||
|
||||
class DeviceCodeEndpoint(PublicEndpoint):
|
||||
|
@ -17,7 +16,6 @@ class DeviceCodeEndpoint(PublicEndpoint):
|
|||
def __init__(self):
|
||||
super(DeviceCodeEndpoint, self).__init__()
|
||||
self.device_pairing_time = 86400
|
||||
self.cache: SeleneCache = self.config.get('SELENE_CACHE')
|
||||
self.sha512 = hashlib.sha512()
|
||||
|
||||
def get(self):
|
||||
|
|
|
@ -4,7 +4,6 @@ import uuid
|
|||
from http import HTTPStatus
|
||||
|
||||
from selene.api import PublicEndpoint
|
||||
from selene.util.cache import SeleneCache
|
||||
|
||||
|
||||
class DeviceRefreshTokenEndpoint(PublicEndpoint):
|
||||
|
@ -13,7 +12,6 @@ class DeviceRefreshTokenEndpoint(PublicEndpoint):
|
|||
|
||||
def __init__(self):
|
||||
super(DeviceRefreshTokenEndpoint, self).__init__()
|
||||
self.cache: SeleneCache = self.config['SELENE_CACHE']
|
||||
self.sha512 = hashlib.sha512()
|
||||
|
||||
def get(self):
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
from flask import current_app, request
|
||||
from flask.views import MethodView
|
||||
|
||||
from ..util.cache import SeleneCache
|
||||
|
||||
|
||||
class PublicEndpoint(MethodView):
|
||||
"""Abstract class for all endpoints used by Mycroft devices"""
|
||||
|
@ -8,3 +10,4 @@ class PublicEndpoint(MethodView):
|
|||
def __init__(self):
|
||||
self.config: dict = current_app.config
|
||||
self.request = request
|
||||
self.cache: SeleneCache = self.config['SELENE_CACHE']
|
||||
|
|
Loading…
Reference in New Issue