python_bot/db_logic/collections.py
Simple_Not 66c2ef80c3
All checks were successful
continuous-integration/drone/push Build is passing
#10 теперь логгируется
2024-01-24 14:09:31 +10:00

41 lines
1.3 KiB
Python

from global_conf import CONFIG
#### https://docs.python-arango.com/en/main/
from arango import ArangoClient
import logging
def get_dicks_collection():
try:
arango_client = ArangoClient(hosts=CONFIG['databaso']['host'] )
pipisa_db = arango_client.db(
CONFIG['databaso']['base'],
username=CONFIG['databaso']['user'],
password=CONFIG['databaso']['pass']
)
dicks_collection = pipisa_db.collection(CONFIG['databaso']['collection'])
return dicks_collection
except Exception as e:
logging.error('ошибка DB при взятии коллекции пипис')
logging.error(e)
def get_posts_removal_collection():
try:
arango_client = ArangoClient(hosts=CONFIG['databaso']['host'] )
pipisa_db = arango_client.db(
CONFIG['databaso']['base'],
username=CONFIG['databaso']['user'],
password=CONFIG['databaso']['pass']
)
posts_removal_collection = pipisa_db.collection(CONFIG['databaso']['posts_removal_collection'])
return posts_removal_collection
except Exception as e:
logging.error('ошибка DB при взятии коллекции постов-на-удаление')
logging.error(e)