fastapi-basic 0.1.0__py3-none-any.whl → 0.1.1__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/database/__init__.py +0 -0
- fastapi_basic/database/mongodb.py +29 -0
- {fastapi_basic-0.1.0.dist-info → fastapi_basic-0.1.1.dist-info}/METADATA +1 -1
- {fastapi_basic-0.1.0.dist-info → fastapi_basic-0.1.1.dist-info}/RECORD +6 -4
- {fastapi_basic-0.1.0.dist-info → fastapi_basic-0.1.1.dist-info}/WHEEL +0 -0
- {fastapi_basic-0.1.0.dist-info → fastapi_basic-0.1.1.dist-info}/top_level.txt +0 -0
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from beanie import init_beanie
|
|
2
|
+
from motor.motor_asyncio import AsyncIOMotorClient
|
|
3
|
+
|
|
4
|
+
class MongoDB:
|
|
5
|
+
def __init__(self, username: str, password: str, host: str, port: int, db_name: str, ssl: str=None, ssl_ca_certs: str=None):
|
|
6
|
+
self.username = username
|
|
7
|
+
self.password = password
|
|
8
|
+
self.host = host
|
|
9
|
+
self.port = port
|
|
10
|
+
self.db_name = db_name
|
|
11
|
+
self.ssl = ssl
|
|
12
|
+
self.ssl_ca_certs = ssl_ca_certs
|
|
13
|
+
|
|
14
|
+
async def connect(self, document_models: list):
|
|
15
|
+
db_settings = dict(
|
|
16
|
+
username=self.username,
|
|
17
|
+
password=self.password,
|
|
18
|
+
host=self.host,
|
|
19
|
+
port=self.port,
|
|
20
|
+
retryWrites=False
|
|
21
|
+
)
|
|
22
|
+
if self.ssl:
|
|
23
|
+
db_settings["ssl"] = self.ssl
|
|
24
|
+
|
|
25
|
+
if self.ssl_ca_certs and self.ssl_ca_certs != "":
|
|
26
|
+
db_settings["tlsCAFile"] = self.ssl_ca_certs
|
|
27
|
+
|
|
28
|
+
self.client = AsyncIOMotorClient(**db_settings)
|
|
29
|
+
await init_beanie(database=self.client[self.db_name], document_models=document_models)
|
|
@@ -3,12 +3,14 @@ fastapi_basic/base_config.py,sha256=nimiiK5LRY9kmx3dBDbN7teO4R8E423-c2iyq9WMcCg,
|
|
|
3
3
|
fastapi_basic/base_factory.py,sha256=xrM4tbKjrhtqpzP2hupGJxiNeGsDnXfMYe8urOcq-ss,3801
|
|
4
4
|
fastapi_basic/const.py,sha256=UA7-Eefu_dbWpbFn09Ei_BPb903SExnCgVbnm8_3ALE,99
|
|
5
5
|
fastapi_basic/utils.py,sha256=8ympyQIXsKkxLILTI_7ug85vmKWYKqX0mpADjgHekgU,306
|
|
6
|
+
fastapi_basic/database/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
fastapi_basic/database/mongodb.py,sha256=XW7ApqYkR1Jf7LM1HaZ6jzYgajzuu1whKw5cpsjSO-M,1017
|
|
6
8
|
fastapi_basic/exception/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
9
|
fastapi_basic/exception/base_exception.py,sha256=xkpvAI8G96sqXqHgQC_rs2ZPL1liwKVXbXBIPF_8HPQ,473
|
|
8
10
|
fastapi_basic/ext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
11
|
fastapi_basic/ext/aws/__init__.py,sha256=N_cwnbv1N-F1SY6NenBOTZe20zGaKFu3UXAu17hFAXY,816
|
|
10
12
|
fastapi_basic/ext/aws/const.py,sha256=Mmb6lo11aZZDAVy-nK-v_JxtVPPKYUo9GB4ihH7XYuM,68
|
|
11
|
-
fastapi_basic-0.1.
|
|
12
|
-
fastapi_basic-0.1.
|
|
13
|
-
fastapi_basic-0.1.
|
|
14
|
-
fastapi_basic-0.1.
|
|
13
|
+
fastapi_basic-0.1.1.dist-info/METADATA,sha256=vopBHifYhaFjN8jw_Vm1sL2b7uiWfBpiVU0UAJGV3SY,1740
|
|
14
|
+
fastapi_basic-0.1.1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
15
|
+
fastapi_basic-0.1.1.dist-info/top_level.txt,sha256=Q9PdwWxaB4dy135MQHiroRYOqArdUSaIeEkzYinN6W0,14
|
|
16
|
+
fastapi_basic-0.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|