mirror of
https://github.com/tgbot-collection/YYeTsBot.git
synced 2025-11-25 03:15:05 +08:00
27 lines
495 B
Python
27 lines
495 B
Python
#!/usr/local/bin/python3
|
|
# coding: utf-8
|
|
|
|
# YYeTsBot - common.py
|
|
# 3/26/22 10:40
|
|
#
|
|
|
|
__author__ = "Benny <benny.think@gmail.com>"
|
|
|
|
import os
|
|
|
|
import pymongo
|
|
|
|
|
|
class Mongo:
|
|
def __init__(self):
|
|
self.client = pymongo.MongoClient(
|
|
host=os.getenv("MONGO", "localhost"),
|
|
connect=False,
|
|
connectTimeoutMS=5000,
|
|
serverSelectionTimeoutMS=5000,
|
|
)
|
|
self.db = self.client["zimuzu"]
|
|
|
|
def __del__(self):
|
|
self.client.close()
|