iPavel89-work
3/31/2020 - 6:42 AM

Проверка оплаты через zabbix

#!/usr/bin/python3
import pymongo
from sys import argv
from bson import ObjectId
from bson.json_util import dumps
obj=argv[1]
obj=ObjectId(obj)
myclient = pymongo.MongoClient("mongodb://localhost:27017/")
mydb = myclient["openhab"] #Выбираем бд
mycol = mydb["users"]
myquery = {"account":obj} # Делаем выборку 
query = mycol.find(myquery)
for x in query:
    state=dumps(x['active'])
    print(state)