Skip to content

Commit

Permalink
Merge pull request #7 from TogetherCrew/feature/10-create-a-python-se…
Browse files Browse the repository at this point in the history
…rvice-template-repository

MongoDB
  • Loading branch information
cyri113 authored Jul 28, 2023
2 parents cd1a84c + be3fe6b commit 47bf152
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions mongodb_connection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import os

from dotenv import load_dotenv
from pymongo import MongoClient

load_dotenv()

host = os.getenv("DB_HOST")
port = os.getenv("DB_PORT")
user = os.getenv("DB_USER")
password = os.getenv("DB_PASSWORD")
db_name = os.getenv("DB_NAME")

mongodb_connection = f"mongodb://{user}:{password}@{host}:{port}/{db_name}"
client = MongoClient(host=mongodb_connection)
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
async-timeout==4.0.2
attrs==22.2.0
cffi==1.15.1
click==8.1.6
coverage==7.2.7
cryptography==41.0.2
dnspython==2.2.1
exceptiongroup==1.1.0
iniconfig==2.0.0
Expand All @@ -11,6 +13,7 @@ numpy==1.25.1
packaging==23.0
pandas==2.0.3
pluggy==1.0.0
pycparser==2.21
pymongo==4.3.3
pytest==7.2.0
python-dateutil==2.8.2
Expand All @@ -20,4 +23,5 @@ redis==4.6.0
rq==1.15.1
six==1.16.0
tomli==2.0.1
types-pyOpenSSL==23.2.0.2
tzdata==2023.3

0 comments on commit 47bf152

Please sign in to comment.