mirror of
https://github.com/tgbot-collection/YYeTsBot.git
synced 2025-11-25 19:37:34 +08:00
23 lines
480 B
Python
23 lines
480 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") or "localhost", connect=False,
|
|
connectTimeoutMS=5000, serverSelectionTimeoutMS=5000)
|
|
self.db = self.client["zimuzu"]
|
|
|
|
def __del__(self):
|
|
self.client.close()
|