panther 5.0.0b1__tar.gz → 5.0.0b3__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.
- {panther-5.0.0b1 → panther-5.0.0b3}/PKG-INFO +1 -1
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/__init__.py +1 -1
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/db/queries/mongodb_queries.py +6 -4
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/main.py +10 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/panel/views.py +4 -1
- {panther-5.0.0b1 → panther-5.0.0b3}/panther.egg-info/PKG-INFO +1 -1
- {panther-5.0.0b1 → panther-5.0.0b3}/LICENSE +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/README.md +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/_load_configs.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/_utils.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/app.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/authentications.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/background_tasks.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/base_request.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/base_websocket.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/caching.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/cli/__init__.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/cli/create_command.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/cli/main.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/cli/monitor_command.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/cli/run_command.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/cli/template.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/cli/utils.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/configs.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/db/__init__.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/db/connections.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/db/cursor.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/db/models.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/db/queries/__init__.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/db/queries/base_queries.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/db/queries/pantherdb_queries.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/db/queries/queries.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/db/utils.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/events.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/exceptions.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/file_handler.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/generics.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/logging.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/middlewares/__init__.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/middlewares/base.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/middlewares/monitoring.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/monitoring.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/openapi/__init__.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/openapi/templates/openapi.html +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/openapi/urls.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/openapi/utils.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/openapi/views.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/pagination.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/panel/__init__.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/panel/apis.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/panel/middlewares.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/panel/templates/base.html +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/panel/templates/create.html +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/panel/templates/create.js +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/panel/templates/detail.html +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/panel/templates/home.html +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/panel/templates/home.js +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/panel/templates/login.html +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/panel/templates/sidebar.html +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/panel/templates/table.html +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/panel/templates/table.js +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/panel/urls.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/panel/utils.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/permissions.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/request.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/response.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/routings.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/serializer.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/status.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/test.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/throttling.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/utils.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther/websocket.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther.egg-info/SOURCES.txt +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther.egg-info/dependency_links.txt +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther.egg-info/entry_points.txt +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther.egg-info/requires.txt +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/panther.egg-info/top_level.txt +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/pyproject.toml +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/setup.cfg +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/setup.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_authentication.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_background_tasks.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_caching.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_cli.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_database.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_database_advance.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_events.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_generics.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_middlewares.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_multipart.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_openapi.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_panel_apis.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_request.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_response.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_routing.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_run.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_serializer.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_status.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_throttling.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_utils.py +0 -0
- {panther-5.0.0b1 → panther-5.0.0b3}/tests/test_websockets.py +0 -0
@@ -6,7 +6,6 @@ from sys import version_info
|
|
6
6
|
from typing import get_args, get_origin, Iterable, Sequence, Any, Union
|
7
7
|
|
8
8
|
from pydantic import BaseModel, ValidationError
|
9
|
-
from pymongo.results import InsertOneResult, InsertManyResult
|
10
9
|
|
11
10
|
from panther.db.connections import db
|
12
11
|
from panther.db.cursor import Cursor
|
@@ -17,11 +16,14 @@ from panther.exceptions import DatabaseError
|
|
17
16
|
|
18
17
|
try:
|
19
18
|
from bson.codec_options import CodecOptions
|
19
|
+
from pymongo.results import InsertOneResult, InsertManyResult
|
20
20
|
except ImportError:
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
21
|
+
# MongoDB-related libraries are not required by default.
|
22
|
+
# If the user intends to use MongoDB, they must install the required dependencies explicitly.
|
23
|
+
# This will be enforced in `panther.db.connections.MongoDBConnection.init`.
|
24
24
|
CodecOptions = type('CodecOptions', (), {})
|
25
|
+
InsertOneResult = type('InsertOneResult', (), {})
|
26
|
+
InsertManyResult = type('InsertManyResult', (), {})
|
25
27
|
|
26
28
|
if version_info >= (3, 11):
|
27
29
|
from typing import Self
|
@@ -26,6 +26,16 @@ logger = logging.getLogger('panther')
|
|
26
26
|
|
27
27
|
class Panther:
|
28
28
|
def __init__(self, name: str, configs: str | None = None, urls: dict | None = None):
|
29
|
+
"""
|
30
|
+
Initialize a Panther application instance.
|
31
|
+
|
32
|
+
Args:
|
33
|
+
name: Typically set to `__name__`; used to determine the current directory of the application.
|
34
|
+
configs: The name of the module containing your configuration.
|
35
|
+
If the configuration is defined in the current file, you can also set this to `__name__`.
|
36
|
+
urls: A dictionary containing your URL routing.
|
37
|
+
If not provided, Panther will attempt to load `URLs` from the configs module.
|
38
|
+
"""
|
29
39
|
self._configs_module_name = configs
|
30
40
|
self._urls = urls
|
31
41
|
|
@@ -2,7 +2,6 @@ import logging
|
|
2
2
|
|
3
3
|
from panther import status
|
4
4
|
from panther.app import API, GenericAPI
|
5
|
-
from panther.authentications import JWTAuthentication, CookieJWTAuthentication
|
6
5
|
from panther.configs import config
|
7
6
|
from panther.db.models import BaseUser
|
8
7
|
from panther.exceptions import RedirectAPIError, AuthenticationAPIError
|
@@ -18,6 +17,8 @@ logger = logging.getLogger('panther')
|
|
18
17
|
class AdminPanelPermission(BasePermission):
|
19
18
|
@classmethod
|
20
19
|
async def authorization(cls, request: Request) -> bool:
|
20
|
+
from panther.authentications import CookieJWTAuthentication
|
21
|
+
|
21
22
|
try: # We don't want to set AUTHENTICATION class, so we have to use permission classes
|
22
23
|
await CookieJWTAuthentication.authentication(request=request)
|
23
24
|
return True
|
@@ -32,6 +33,8 @@ class LoginView(GenericAPI):
|
|
32
33
|
return TemplateResponse(name='login.html')
|
33
34
|
|
34
35
|
async def post(self, request: Request):
|
36
|
+
from panther.authentications import JWTAuthentication
|
37
|
+
|
35
38
|
user: BaseUser = await config.USER_MODEL.find_one({config.USER_MODEL.USERNAME_FIELD: request.data['username']})
|
36
39
|
if user is None:
|
37
40
|
logger.debug('User not found.')
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|