41 lines
1.3 KiB
Python
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)
|