diff --git a/app.py b/app.py index eb34a38..67fbfa2 100644 --- a/app.py +++ b/app.py @@ -9,7 +9,8 @@ from typing_extensions import Annotated from bson import ObjectId -import motor.motor_asyncio +import asyncio +from pymongo import AsyncMongoClient from pymongo import ReturnDocument @@ -17,7 +18,7 @@ title="Student Course API", summary="A sample application showing how to use FastAPI to add a ReST API to a MongoDB collection.", ) -client = motor.motor_asyncio.AsyncIOMotorClient(os.environ["MONGODB_URL"]) +client = AsyncMongoClient(os.environ["MONGODB_URL"]) db = client.college student_collection = db.get_collection("students") diff --git a/dev-requirements.in b/dev-requirements.in deleted file mode 100644 index b16298f..0000000 --- a/dev-requirements.in +++ /dev/null @@ -1,3 +0,0 @@ -requests -pytest -pip-tools \ No newline at end of file diff --git a/dev-requirements.txt b/dev-requirements.txt deleted file mode 100644 index 8b77d72..0000000 --- a/dev-requirements.txt +++ /dev/null @@ -1,42 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.12 -# by the following command: -# -# pip-compile --strip-extras dev-requirements.in -# -build==1.1.1 - # via pip-tools -certifi==2023.7.22 - # via requests -charset-normalizer==3.3.1 - # via requests -click==8.1.7 - # via pip-tools -idna==3.4 - # via requests -iniconfig==2.0.0 - # via pytest -packaging==23.2 - # via - # build - # pytest -pip-tools==7.4.1 - # via -r dev-requirements.in -pluggy==1.3.0 - # via pytest -pyproject-hooks==1.0.0 - # via - # build - # pip-tools -pytest==7.4.3 - # via -r dev-requirements.in -requests==2.31.0 - # via -r dev-requirements.in -urllib3==2.0.7 - # via requests -wheel==0.42.0 - # via pip-tools - -# The following packages are considered to be unsafe in a requirements file: -# pip -# setuptools diff --git a/requirements.in b/requirements.in index 113d9d3..72d2551 100644 --- a/requirements.in +++ b/requirements.in @@ -1,4 +1,4 @@ fastapi ~=0.110 -motor ~=3.3 +pymongo ~=4.13 uvicorn ~=0.28 -pydantic[email] \ No newline at end of file +pydantic[email] diff --git a/requirements.txt b/requirements.txt index 9bf9d19..56e7967 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,15 +24,13 @@ idna==3.4 # via # anyio # email-validator -motor==3.3.1 - # via -r requirements.in pydantic==2.6.3 # via # -r requirements.in # fastapi pydantic-core==2.16.3 # via pydantic -pymongo==4.5.0 +pymongo==4.13.1 # via motor sniffio==1.3.0 # via anyio