pluginserver 0.6.0__tar.gz → 0.6.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pluginserver-0.6.0/pluginserver.egg-info → pluginserver-0.6.3}/PKG-INFO +1 -1
- {pluginserver-0.6.0 → pluginserver-0.6.3}/plugincore/baseplugin.py +9 -4
- {pluginserver-0.6.0 → pluginserver-0.6.3/pluginserver.egg-info}/PKG-INFO +1 -1
- {pluginserver-0.6.0 → pluginserver-0.6.3}/setup.py +1 -1
- {pluginserver-0.6.0 → pluginserver-0.6.3}/LICENSE.txt +0 -0
- {pluginserver-0.6.0 → pluginserver-0.6.3}/MANIFEST.in +0 -0
- {pluginserver-0.6.0 → pluginserver-0.6.3}/README.md +0 -0
- {pluginserver-0.6.0 → pluginserver-0.6.3}/plugincore/__init__.py +0 -0
- {pluginserver-0.6.0 → pluginserver-0.6.3}/plugincore/configfile.py +0 -0
- {pluginserver-0.6.0 → pluginserver-0.6.3}/plugincore/cors.py +0 -0
- {pluginserver-0.6.0 → pluginserver-0.6.3}/plugincore/pluginmanager.py +0 -0
- {pluginserver-0.6.0 → pluginserver-0.6.3}/plugincore/pserv.py +0 -0
- {pluginserver-0.6.0 → pluginserver-0.6.3}/pluginserver.egg-info/SOURCES.txt +0 -0
- {pluginserver-0.6.0 → pluginserver-0.6.3}/pluginserver.egg-info/dependency_links.txt +0 -0
- {pluginserver-0.6.0 → pluginserver-0.6.3}/pluginserver.egg-info/entry_points.txt +0 -0
- {pluginserver-0.6.0 → pluginserver-0.6.3}/pluginserver.egg-info/requires.txt +0 -0
- {pluginserver-0.6.0 → pluginserver-0.6.3}/pluginserver.egg-info/top_level.txt +0 -0
- {pluginserver-0.6.0 → pluginserver-0.6.3}/setup.cfg +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import asyncio
|
|
1
2
|
from aiohttp import web
|
|
2
|
-
import
|
|
3
|
+
import inspect
|
|
3
4
|
|
|
4
5
|
class BasePlugin:
|
|
5
6
|
"""
|
|
@@ -12,7 +13,9 @@ class BasePlugin:
|
|
|
12
13
|
self._apikey = None
|
|
13
14
|
self.config = kwargs.get('config')
|
|
14
15
|
self._plugin_id = kwargs.get('route_path',self.__class__.__name__.lower())
|
|
15
|
-
auth = kwargs.get('auth_type')
|
|
16
|
+
auth = kwargs.get('auth_type')
|
|
17
|
+
if auth:
|
|
18
|
+
auth = auth.lower()
|
|
16
19
|
if auth:
|
|
17
20
|
if auth == 'global':
|
|
18
21
|
if 'auth' in self.config and 'apikey' in self.config.auth:
|
|
@@ -54,7 +57,7 @@ class BasePlugin:
|
|
|
54
57
|
toktype='userdata'
|
|
55
58
|
return token
|
|
56
59
|
user_key = get_token(data) or get_custom_header_token(data) or get_user_token(data)
|
|
57
|
-
print(f"_check_auth: type: {toktype} {self._auth_type} apikey {self._apikey}, args {data}")
|
|
60
|
+
#print(f"_check_auth: type: {toktype} {self._auth_type} apikey {self._apikey}, args {data}")
|
|
58
61
|
|
|
59
62
|
if self._auth_type:
|
|
60
63
|
#print(f"Checking {user_key}")
|
|
@@ -73,7 +76,9 @@ class BasePlugin:
|
|
|
73
76
|
async def handle_request(self, **data):
|
|
74
77
|
auth_check = self._check_auth(data)
|
|
75
78
|
if auth_check:
|
|
76
|
-
|
|
79
|
+
result = self.request_handler(**data)
|
|
80
|
+
code, response = await result if inspect.isawaitable(result) else result
|
|
81
|
+
print(f"Got {code} - {response}")
|
|
77
82
|
else:
|
|
78
83
|
code, response = 403, {'error': 'unauthorized'}
|
|
79
84
|
if not isinstance(response,web.Response):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|