python_bot_v2/db_logic/collections.py
2024-01-23 15:12:59 +10:00

39 lines
1.2 KiB
Python

from global_conf import CONFIG
#### https://docs.python-arango.com/en/main/
from arango import ArangoClient
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:
print('ошибка DB при взятии коллекции пипис')
print(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:
print('ошибка DB при взятии коллекции постов-на-удаление')
print(e)