use var env instead of file
This commit is contained in:
parent
9fe47559a7
commit
9486431450
1 changed files with 8 additions and 10 deletions
|
@ -18,17 +18,12 @@ def main():
|
|||
|
||||
recent_date = datetime.now() - monthdelta()
|
||||
|
||||
rocket = RocketChat(None, None, auth_token=cfg.rocket['auth_token'], user_id=cfg.rocket['user_id'], server_url=cfg.rocket['server'])
|
||||
rocket = RocketChat(os.environ['ROCKETCHAT_USER'], os.environ['ROCKETCHAT_PWD'], server_url=cfg.rocket['server'])
|
||||
|
||||
print("Check users")
|
||||
users = getAllUsers(rocket)
|
||||
crapauds_total = len(users)
|
||||
for user in users:
|
||||
date = user["createdAt"]
|
||||
user_date = datetime.strptime(date, "%Y-%m-%dT%H:%M:%S.%fZ")
|
||||
if user_date > recent_date:
|
||||
crapauds_recent += 1
|
||||
|
||||
users = rocket.users_list().json()
|
||||
crapauds_total = users["total"]
|
||||
|
||||
print("Check channels")
|
||||
channels = getAllChannels(rocket)
|
||||
channels_total = len(channels)
|
||||
|
@ -42,7 +37,10 @@ def main():
|
|||
channels_list.append(channel["name"])
|
||||
print("Check messages for channels {}".format(channel['name']))
|
||||
messages = rocket.channels_history(channel["_id"], oldest= recent_date, count= 10000).json()
|
||||
messages_recent += len(messages["messages"])
|
||||
if messages["success"]:
|
||||
messages_recent += len(messages["messages"])
|
||||
else:
|
||||
print("Error : {}".format(messages["error"]))
|
||||
|
||||
info = {
|
||||
"crapauds": {
|
||||
|
|
Loading…
Reference in a new issue