mirror of https://github.com/Bunsly/JobSpy
parent
c1dabdb88a
commit
95c1672f11
|
@ -16,7 +16,7 @@ class Position(Enum):
|
|||
HR_RECRUITMENT = "HR & Recruitment"
|
||||
MOBILE_DEVELOPMENT = "Mobile Development"
|
||||
HARDWARE_ENGINEERING = "Hardware Engineering"
|
||||
EMBEDDED_ENGINEERING = "Embedded, Low Level & Firmware Engineering",
|
||||
EMBEDDED_ENGINEERING = "Embedded, Low Level & Firmware Engineering"
|
||||
CUSTOMER_SUCCESS = "Customer Success"
|
||||
PROJECT_MANAGEMENT = "Project Management"
|
||||
OPERATIONS = "Operations"
|
|
@ -1,5 +1,3 @@
|
|||
import os
|
||||
|
||||
from pymongo import MongoClient
|
||||
from pymongo.synchronous.database import Database
|
||||
|
||||
|
@ -8,29 +6,33 @@ from jobspy import create_logger
|
|||
|
||||
|
||||
class MongoDB:
|
||||
_instance = None
|
||||
db:Database = None
|
||||
def __new__(cls):
|
||||
|
||||
if cls._instance is not None:
|
||||
return cls._instance
|
||||
|
||||
self = super().__new__(cls)
|
||||
cls._instance = self
|
||||
def __init__(self):
|
||||
logger = create_logger("Mongo Client")
|
||||
mongoUri = settings.mongo_uri
|
||||
if not mongoUri:
|
||||
mongo_uri = settings.mongo_uri
|
||||
if not mongo_uri:
|
||||
logger.error("MONGO_URI environment variable is not set")
|
||||
raise ValueError("MONGO_URI environment variable is not set")
|
||||
client = MongoClient(mongoUri)
|
||||
client = MongoClient(mongo_uri)
|
||||
database_name = settings.mongo_db_name
|
||||
if not database_name:
|
||||
logger.error("MONGO_DB_NAME environment variable is not set")
|
||||
raise ValueError(
|
||||
"MONGO_DB_NAME environment variable is not set")
|
||||
|
||||
self.db = client[database_name]
|
||||
self._db: Database = client[database_name]
|
||||
logger.info("Succeed connect to MongoDB")
|
||||
return cls._instance
|
||||
|
||||
def get_collection(self,
|
||||
name: str,
|
||||
codec_options=None,
|
||||
read_preference=None,
|
||||
write_concern=None,
|
||||
read_concern=None):
|
||||
return self._db.get_collection(name,
|
||||
codec_options,
|
||||
read_preference,
|
||||
write_concern,
|
||||
read_concern)
|
||||
|
||||
|
||||
mongo_client = MongoDB()
|
|
@ -1,5 +1,5 @@
|
|||
START_MESSAGE: str = "Hi there! I'm Professor Bot, your friendly job search assistant.😊\n" \
|
||||
"I'm here to help you find the perfect position." \
|
||||
"I'm here to help you find the perfect position.\n\n" \
|
||||
"To stop chatting with me at any time, just send '/cancel'.\n\n"
|
||||
|
||||
POSITION_MESSAGE: str = "What kind of position are you looking for? ✨\n" \
|
||||
|
|
Loading…
Reference in New Issue