fastapi-basic 0.1.7__py3-none-any.whl → 0.1.8__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.
Potentially problematic release.
This version of fastapi-basic might be problematic. Click here for more details.
- fastapi_basic/base_config.py +6 -1
- fastapi_basic/base_factory.py +15 -1
- fastapi_basic/const.py +3 -1
- {fastapi_basic-0.1.7.dist-info → fastapi_basic-0.1.8.dist-info}/METADATA +13 -1
- {fastapi_basic-0.1.7.dist-info → fastapi_basic-0.1.8.dist-info}/RECORD +7 -7
- {fastapi_basic-0.1.7.dist-info → fastapi_basic-0.1.8.dist-info}/WHEEL +0 -0
- {fastapi_basic-0.1.7.dist-info → fastapi_basic-0.1.8.dist-info}/top_level.txt +0 -0
fastapi_basic/base_config.py
CHANGED
|
@@ -14,4 +14,9 @@ class BaseConfig(BaseSettings):
|
|
|
14
14
|
AWS_SECRET_KEY: str = ""
|
|
15
15
|
AWS_REGION: str = ""
|
|
16
16
|
AWS_PARAMETER_PATH_PREFIX: str = ""
|
|
17
|
-
AWS_LOGGROUP_NAME: str = ""
|
|
17
|
+
AWS_LOGGROUP_NAME: str = ""
|
|
18
|
+
|
|
19
|
+
# Celery config
|
|
20
|
+
CELERY_APP: str|None = ""
|
|
21
|
+
CELERY_BROKER_URL: str|None = ""
|
|
22
|
+
CELERY_BACKEND_URL: str|None = ""
|
fastapi_basic/base_factory.py
CHANGED
|
@@ -3,13 +3,14 @@ from functools import lru_cache
|
|
|
3
3
|
import os, dotenv
|
|
4
4
|
|
|
5
5
|
import watchtower
|
|
6
|
+
from celery import Celery
|
|
6
7
|
from fastapi import FastAPI, HTTPException, Request
|
|
7
8
|
from fastapi.responses import JSONResponse
|
|
8
9
|
from fastapi.middleware.cors import CORSMiddleware
|
|
9
10
|
from starlette.concurrency import iterate_in_threadpool
|
|
10
11
|
import logging
|
|
11
12
|
|
|
12
|
-
from .const import LOG_DEFAULT_LOGGER_NAME, LOG_FMT
|
|
13
|
+
from .const import LOG_DEFAULT_LOGGER_NAME, LOG_FMT, CELERY_CONFIG
|
|
13
14
|
from .ext.aws import init_app as init_aws_app
|
|
14
15
|
from .exception.base_exception import InternalBaseException
|
|
15
16
|
from .utils import update_dict_with_cast
|
|
@@ -48,6 +49,17 @@ class BaseFactory(metaclass=ABCMeta):
|
|
|
48
49
|
watchtower_handler.setFormatter(logging.Formatter(LOG_FMT))
|
|
49
50
|
app.logger.addHandler(watchtower_handler)
|
|
50
51
|
|
|
52
|
+
def __setup_celery_app(self, app):
|
|
53
|
+
if not all([app.state.config.get(key) for key in CELERY_CONFIG]):
|
|
54
|
+
app.logger.info("Lack Celery config keys, ignore get Celery_app")
|
|
55
|
+
return None
|
|
56
|
+
|
|
57
|
+
app.state.celery_app = Celery(
|
|
58
|
+
app.state.config.get("CELERY_APP"),
|
|
59
|
+
broker=app.state.config.get("CELERY_BROKER_URL"),
|
|
60
|
+
backend=app.state.config.get("CELERY_BACKEND_URL")
|
|
61
|
+
)
|
|
62
|
+
|
|
51
63
|
def create_app(self):
|
|
52
64
|
"""
|
|
53
65
|
Create an application instance.
|
|
@@ -68,6 +80,8 @@ class BaseFactory(metaclass=ABCMeta):
|
|
|
68
80
|
app.state.aws_session = init_aws_app(app)
|
|
69
81
|
self.__setup_aws_cloud_log(app)
|
|
70
82
|
|
|
83
|
+
self.__setup_celery_app(app)
|
|
84
|
+
|
|
71
85
|
@app.exception_handler(InternalBaseException)
|
|
72
86
|
async def http_exception_handler(request: Request, exc: InternalBaseException):
|
|
73
87
|
return JSONResponse(
|
fastapi_basic/const.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastapi_basic
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
4
4
|
Summary: A short description of your module
|
|
5
5
|
Home-page: https://github.com/szx21023/fastapi-base
|
|
6
6
|
Author: szx21023
|
|
@@ -14,14 +14,20 @@ Requires-Dist: aenum==3.1.16
|
|
|
14
14
|
Requires-Dist: aiohappyeyeballs==2.6.1
|
|
15
15
|
Requires-Dist: aiohttp==3.10.5
|
|
16
16
|
Requires-Dist: aiosignal==1.3.2
|
|
17
|
+
Requires-Dist: amqp==5.3.1
|
|
17
18
|
Requires-Dist: annotated-types==0.7.0
|
|
18
19
|
Requires-Dist: anyio==4.9.0
|
|
19
20
|
Requires-Dist: attrs==25.3.0
|
|
21
|
+
Requires-Dist: billiard==4.2.1
|
|
20
22
|
Requires-Dist: boto3==1.37.36
|
|
21
23
|
Requires-Dist: botocore==1.37.36
|
|
24
|
+
Requires-Dist: celery==5.5.2
|
|
22
25
|
Requires-Dist: certifi==2025.1.31
|
|
23
26
|
Requires-Dist: charset-normalizer==3.4.1
|
|
24
27
|
Requires-Dist: click==8.1.8
|
|
28
|
+
Requires-Dist: click-didyoumean==0.3.1
|
|
29
|
+
Requires-Dist: click-plugins==1.1.1
|
|
30
|
+
Requires-Dist: click-repl==0.3.0
|
|
25
31
|
Requires-Dist: Deprecated==1.2.18
|
|
26
32
|
Requires-Dist: dotenv==0.9.9
|
|
27
33
|
Requires-Dist: fastapi==0.115.12
|
|
@@ -30,14 +36,17 @@ Requires-Dist: future==1.0.0
|
|
|
30
36
|
Requires-Dist: h11==0.14.0
|
|
31
37
|
Requires-Dist: idna==3.10
|
|
32
38
|
Requires-Dist: jmespath==1.0.1
|
|
39
|
+
Requires-Dist: kombu==5.5.3
|
|
33
40
|
Requires-Dist: line-bot-sdk==3.12.0
|
|
34
41
|
Requires-Dist: multidict==6.4.3
|
|
42
|
+
Requires-Dist: prompt_toolkit==3.0.51
|
|
35
43
|
Requires-Dist: propcache==0.3.1
|
|
36
44
|
Requires-Dist: pydantic==2.11.3
|
|
37
45
|
Requires-Dist: pydantic_core==2.33.1
|
|
38
46
|
Requires-Dist: python-dateutil==2.9.0.post0
|
|
39
47
|
Requires-Dist: python-dotenv==1.1.0
|
|
40
48
|
Requires-Dist: python-multipart==0.0.20
|
|
49
|
+
Requires-Dist: redis==6.1.0
|
|
41
50
|
Requires-Dist: requests==2.32.3
|
|
42
51
|
Requires-Dist: s3transfer==0.11.5
|
|
43
52
|
Requires-Dist: six==1.17.0
|
|
@@ -45,9 +54,12 @@ Requires-Dist: sniffio==1.3.1
|
|
|
45
54
|
Requires-Dist: starlette==0.46.1
|
|
46
55
|
Requires-Dist: typing-inspection==0.4.0
|
|
47
56
|
Requires-Dist: typing_extensions==4.13.1
|
|
57
|
+
Requires-Dist: tzdata==2025.2
|
|
48
58
|
Requires-Dist: urllib3==2.3.0
|
|
49
59
|
Requires-Dist: uvicorn==0.34.0
|
|
60
|
+
Requires-Dist: vine==5.1.0
|
|
50
61
|
Requires-Dist: watchtower==3.4.0
|
|
62
|
+
Requires-Dist: wcwidth==0.2.13
|
|
51
63
|
Requires-Dist: wrapt==1.17.2
|
|
52
64
|
Requires-Dist: yarl==1.20.0
|
|
53
65
|
Dynamic: author
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
fastapi_basic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
fastapi_basic/base_config.py,sha256=
|
|
3
|
-
fastapi_basic/base_factory.py,sha256=
|
|
4
|
-
fastapi_basic/const.py,sha256=
|
|
2
|
+
fastapi_basic/base_config.py,sha256=WtYA7nI7yTw_bmMMIH1JdKiGOl81Vjekf2OpmwtnCww,568
|
|
3
|
+
fastapi_basic/base_factory.py,sha256=G2hSBB6OXNh9lO2oAxEHXaJjjK-CTeG-_lCJxkg0WPc,4319
|
|
4
|
+
fastapi_basic/const.py,sha256=jjNg7nutqtfzrqEKlU-zbzkDo3ndf3aDc603LbGcB_k,174
|
|
5
5
|
fastapi_basic/utils.py,sha256=8ympyQIXsKkxLILTI_7ug85vmKWYKqX0mpADjgHekgU,306
|
|
6
6
|
fastapi_basic/database/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
fastapi_basic/database/mongodb.py,sha256=XW7ApqYkR1Jf7LM1HaZ6jzYgajzuu1whKw5cpsjSO-M,1017
|
|
@@ -11,7 +11,7 @@ fastapi_basic/ext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
|
11
11
|
fastapi_basic/ext/aws/__init__.py,sha256=N_cwnbv1N-F1SY6NenBOTZe20zGaKFu3UXAu17hFAXY,816
|
|
12
12
|
fastapi_basic/ext/aws/const.py,sha256=Mmb6lo11aZZDAVy-nK-v_JxtVPPKYUo9GB4ihH7XYuM,68
|
|
13
13
|
fastapi_basic/ext/line/__init__.py,sha256=sXxNgGHedRW1JCHrD-JVNXLkcrsZEUiDAAHelgeRKy8,2129
|
|
14
|
-
fastapi_basic-0.1.
|
|
15
|
-
fastapi_basic-0.1.
|
|
16
|
-
fastapi_basic-0.1.
|
|
17
|
-
fastapi_basic-0.1.
|
|
14
|
+
fastapi_basic-0.1.8.dist-info/METADATA,sha256=L1JxAnyBAxF6-8-ME8xYZZIeav6nceMeOeVKmC8DV9A,2530
|
|
15
|
+
fastapi_basic-0.1.8.dist-info/WHEEL,sha256=QZxptf4Y1BKFRCEDxD4h2V0mBFQOVFLFEpvxHmIs52A,91
|
|
16
|
+
fastapi_basic-0.1.8.dist-info/top_level.txt,sha256=Q9PdwWxaB4dy135MQHiroRYOqArdUSaIeEkzYinN6W0,14
|
|
17
|
+
fastapi_basic-0.1.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|