panther 3.8.2__py3-none-any.whl → 4.0.0__py3-none-any.whl

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.
Files changed (52) hide show
  1. panther/__init__.py +1 -1
  2. panther/_load_configs.py +168 -171
  3. panther/_utils.py +26 -49
  4. panther/app.py +85 -105
  5. panther/authentications.py +86 -55
  6. panther/background_tasks.py +25 -14
  7. panther/base_request.py +38 -14
  8. panther/base_websocket.py +172 -94
  9. panther/caching.py +60 -25
  10. panther/cli/create_command.py +20 -10
  11. panther/cli/monitor_command.py +63 -37
  12. panther/cli/template.py +40 -20
  13. panther/cli/utils.py +32 -18
  14. panther/configs.py +65 -58
  15. panther/db/connections.py +139 -0
  16. panther/db/cursor.py +43 -0
  17. panther/db/models.py +64 -29
  18. panther/db/queries/__init__.py +1 -1
  19. panther/db/queries/base_queries.py +127 -0
  20. panther/db/queries/mongodb_queries.py +77 -38
  21. panther/db/queries/pantherdb_queries.py +59 -30
  22. panther/db/queries/queries.py +232 -117
  23. panther/db/utils.py +17 -18
  24. panther/events.py +44 -0
  25. panther/exceptions.py +26 -12
  26. panther/file_handler.py +2 -2
  27. panther/generics.py +163 -0
  28. panther/logging.py +7 -2
  29. panther/main.py +111 -188
  30. panther/middlewares/base.py +3 -0
  31. panther/monitoring.py +8 -5
  32. panther/pagination.py +48 -0
  33. panther/panel/apis.py +32 -5
  34. panther/panel/urls.py +2 -1
  35. panther/permissions.py +3 -3
  36. panther/request.py +6 -13
  37. panther/response.py +114 -34
  38. panther/routings.py +83 -66
  39. panther/serializer.py +214 -33
  40. panther/test.py +31 -21
  41. panther/utils.py +28 -16
  42. panther/websocket.py +7 -4
  43. {panther-3.8.2.dist-info → panther-4.0.0.dist-info}/METADATA +93 -71
  44. panther-4.0.0.dist-info/RECORD +57 -0
  45. {panther-3.8.2.dist-info → panther-4.0.0.dist-info}/WHEEL +1 -1
  46. panther/db/connection.py +0 -92
  47. panther/middlewares/db.py +0 -18
  48. panther/middlewares/redis.py +0 -47
  49. panther-3.8.2.dist-info/RECORD +0 -54
  50. {panther-3.8.2.dist-info → panther-4.0.0.dist-info}/LICENSE +0 -0
  51. {panther-3.8.2.dist-info → panther-4.0.0.dist-info}/entry_points.txt +0 -0
  52. {panther-3.8.2.dist-info → panther-4.0.0.dist-info}/top_level.txt +0 -0
panther/middlewares/db.py DELETED
@@ -1,18 +0,0 @@
1
- from panther.db.connection import DBSession
2
- from panther.middlewares.base import BaseMiddleware
3
- from panther.request import Request
4
- from panther.response import Response
5
- from panther.websocket import GenericWebsocket
6
-
7
-
8
- class DatabaseMiddleware(BaseMiddleware):
9
- def __init__(self, **kwargs):
10
- self.url = kwargs['url']
11
-
12
- async def before(self, request: Request | GenericWebsocket) -> Request | GenericWebsocket:
13
- self.db = DBSession(db_url=self.url)
14
- return request
15
-
16
- async def after(self, response: Response | GenericWebsocket) -> Response | GenericWebsocket:
17
- self.db.close()
18
- return response
@@ -1,47 +0,0 @@
1
- import logging
2
-
3
- from panther.cli.utils import import_error
4
- from panther.db.connection import RedisConnection
5
- from panther.middlewares.base import BaseMiddleware
6
- from panther.request import Request
7
- from panther.response import Response
8
- from panther.websocket import GenericWebsocket
9
-
10
- try:
11
- from redis import Redis
12
- except ModuleNotFoundError as e:
13
- import_error(e, package='redis')
14
-
15
- logger = logging.getLogger('panther')
16
-
17
-
18
- class RedisMiddleware(BaseMiddleware):
19
- def __init__(self, **kwargs):
20
- self.kwargs = kwargs
21
- self.validate_host()
22
- self.validate_port()
23
-
24
- def validate_host(self):
25
- if host := self.kwargs.get('host'): # noqa: F841
26
- if False: # TODO: should be valid ip or domain (then remove the 'noqa')
27
- logger.critical('Redis "host" is not valid.')
28
- else:
29
- self.kwargs['host'] = '127.0.0.1'
30
-
31
- def validate_port(self):
32
- port = self.kwargs.setdefault('port', 6379)
33
- if not isinstance(port, int):
34
- logger.critical('Redis "port" is not valid.')
35
-
36
- async def before(self, request: Request | GenericWebsocket) -> Request | GenericWebsocket:
37
- self.redis = RedisConnection(**self.kwargs)
38
- return request
39
-
40
- async def after(self, response: Response | GenericWebsocket) -> Response | GenericWebsocket:
41
- self.redis.close()
42
- return response
43
-
44
- def redis_connection_for_ws(self) -> Redis:
45
- r = Redis(**self.kwargs)
46
- r.ping()
47
- return r
@@ -1,54 +0,0 @@
1
- panther/__init__.py,sha256=BxHPfeiPa9IiyVmruTkfZevBJk7kM_UBuyJDO4YE6J4,110
2
- panther/_load_configs.py,sha256=jlDO5rK040z3LLmMFMJ6jUL9oTKaDKCWebwmdYJPDjw,9567
3
- panther/_utils.py,sha256=BHAOdpESn3dt90FtpPKxEZdnkXnDC7MFcncJYburEaQ,4846
4
- panther/app.py,sha256=3Qf0b-OtczqU5xs7AT7_hFr3t1eFMqzaThQOFu-RoqE,8060
5
- panther/authentications.py,sha256=II3397DOtB2A1zvPbnCibQXekO_dKeclQ8dgU0s_WAc,4397
6
- panther/background_tasks.py,sha256=J6JrjiEzyGohYsaFZHnZtXeP52piP84RlGFLsKOFa-Y,7225
7
- panther/base_request.py,sha256=94mmloCULYtmiRWz-egb5annYp1KQAKFYIAcmIJZZ3o,2897
8
- panther/base_websocket.py,sha256=p8nNr3EolttHmMPtIGgFB3evM2N5XZiX9TwXnZbyMqI,7608
9
- panther/caching.py,sha256=YTFP40aLFR0VabbVYAlHilaALWlCJOrlTNDhG0cRC7c,3075
10
- panther/configs.py,sha256=8pVMWa2QKaeNOlIUCLX3qfNXl0vNdraiGL4OGykFPXI,2884
11
- panther/exceptions.py,sha256=DB6nGfU5LxrglEN_I-HInMqdIA3ZmN8rRv0ynEuQyGA,1332
12
- panther/file_handler.py,sha256=YhqYpGhNybcQBqcxqDEYwI1Hqd-7U5JcwxMb7UM_DbA,854
13
- panther/logging.py,sha256=DZVf3nxzLodT-hD4820J1jEAffU8zIxXRPKs2lbP8ho,2074
14
- panther/main.py,sha256=rBB8e8kuh8BtOq6WPoc_-XOaLX8i-n2HY3ZFPp78Mg4,12304
15
- panther/monitoring.py,sha256=krmcoTUcV12pHwCFVAHywgsp1-US9cyiMlgsrMJdUQ0,1203
16
- panther/permissions.py,sha256=Q-l25369yQaP-tY11tFQm-v9PPh8iVImbfUpY3pnQUk,355
17
- panther/request.py,sha256=u_-pyttspRimlSwpSwyVIV0U87hHDIthsFU9Qr8LDvI,1762
18
- panther/response.py,sha256=5t9-HwgwRo3egqzs1uFNhIq5i5wZW-TRrVX8YEdFrgA,3724
19
- panther/routings.py,sha256=GfwBZL7bt3yVOnpdjOZ-49kiGVrRoF0i8VwS1qkF_oI,5273
20
- panther/serializer.py,sha256=ZvLWwHV2KQdl49ZFRshz4HWXVmFNQtUClggSWkH9pa8,1839
21
- panther/status.py,sha256=Gc_PnYrHfInTsZpGbqiCfDB-py1C7Rh8KMdb6Lq9Exs,3346
22
- panther/test.py,sha256=Se0cF51JRAmABpB_QTIJeTDRKDcyOMlibEN6rrr4Sd8,6152
23
- panther/throttling.py,sha256=mVa_mGv6w_Ad7LLtV4eG5QpDwwNsk4QjFFi0mIHQBnE,231
24
- panther/utils.py,sha256=fWzUrVnXc-98iOC6RIOD4E1KL2rkd6EtbSqqg5ZTG_U,3142
25
- panther/websocket.py,sha256=HEyp3lOTKwitPPX76IfwYdp_gbjjmmrHMizBlLHRmNA,1158
26
- panther/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
- panther/cli/create_command.py,sha256=AshVxzhSpX-L_63OLP7ZgQ5a45NINGomTbvJkCaadks,9671
28
- panther/cli/main.py,sha256=pCqnOTazgMhTvFHTugutIsiFXueU5kx2VmGngwAl54Q,1679
29
- panther/cli/monitor_command.py,sha256=cZ7wOxeQ8jKXgRLP28SgFI9pbIEp4RK6VmVf74WKT6c,2447
30
- panther/cli/run_command.py,sha256=X_T9jP_Z8X_fm9S4LSoR6ARsPp4rCTMi1E5c7QWREjM,2120
31
- panther/cli/template.py,sha256=i4YUgsdVjYhWGoCpoCNQOBo2rKSVk0yx-o_GBmG4yx8,4941
32
- panther/cli/utils.py,sha256=nhtdr9nhYAbCm2S-17vTc3_unjQJ450uxT0ZVyZueIw,4838
33
- panther/db/__init__.py,sha256=w9lEL0vRqb18Qx_iUJipUR_fi5GQ5uVX0DWycx14x08,50
34
- panther/db/connection.py,sha256=9lXzMinGNgQraeu4Sjy92AueR7_AGRsDb0EE0_K4VP4,3039
35
- panther/db/models.py,sha256=7dJ_l0ejVOAVc6qietOYenaRVXBb_O5LNXoyBCLi55g,1434
36
- panther/db/utils.py,sha256=AFVQz-vvfnAj3hcNq4IMo0T7EB8BR9snM-tGsK-Saw4,1667
37
- panther/db/queries/__init__.py,sha256=FpSQGNHGMs5PJow8Qan4eBAld6QH6wfMvj7lC92vKcU,55
38
- panther/db/queries/mongodb_queries.py,sha256=6glGAGNHD1r2DiK5_NOrkZR5GmhangvTc1bvBR22m6A,3362
39
- panther/db/queries/pantherdb_queries.py,sha256=qwjuTC6DLNlGy2z_kBLK1Ep0Oc_UomeHHN1xkItQ5qo,3276
40
- panther/db/queries/queries.py,sha256=PDBxIy0vkC_O2nLqupcbvRRSD99LwEDy0p3Wk2FE1xE,8069
41
- panther/middlewares/__init__.py,sha256=ydo0bSadGqa2v7Xy1oCTkF2uXrImedXjiyx2vPTwPhE,66
42
- panther/middlewares/base.py,sha256=MPbd6SqTFL-ZRz3Q7yooHN5IDCOKHzPIdF6D51EIHkg,729
43
- panther/middlewares/db.py,sha256=Dotc7LPKEZ26w3yK0SY_PhO47JEKJtYpVZPO9SLA2Lg,638
44
- panther/middlewares/redis.py,sha256=3R4uVDODpVUXhji-8WWgQLmPhubw2LJvryUsSwOLXOU,1496
45
- panther/panel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
- panther/panel/apis.py,sha256=HUf9Km81wWtO3pbgW0Oi5MDbLvX5LIWdiFRy05UsitE,1773
47
- panther/panel/urls.py,sha256=BQkWqSJBPP3VEQYeorKSHIRx-PUl21Y7Z6NFylmhs1I,192
48
- panther/panel/utils.py,sha256=0Rv79oR5IEqalqwpRKQHMn1p5duVY5mxMqDKiA5mWx4,437
49
- panther-3.8.2.dist-info/LICENSE,sha256=2aF1hL2aC0zRPjzUkSxJUzZbn2_uLoOkn7DHjzZni-I,1524
50
- panther-3.8.2.dist-info/METADATA,sha256=1bNtyftxbZetjdusrShmCiWOxAAJFkZZJBrQzt-86ww,6023
51
- panther-3.8.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
52
- panther-3.8.2.dist-info/entry_points.txt,sha256=6GPxYFGuzVfNB4YpHFJvYex6iWah5_tLnirAHwj2Qsg,51
53
- panther-3.8.2.dist-info/top_level.txt,sha256=VbBs02JGXTIoHMzsX-eLOk2MCbBZzQbLhWiYpI7xI2g,8
54
- panther-3.8.2.dist-info/RECORD,,