Hide pymongo info logs

Signed-off-by: anasty17 <e.anastayyar@gmail.com>
This commit is contained in:
anasty17 2024-05-04 06:20:32 +03:00
parent 3145af0416
commit 0fd663c8f4
4 changed files with 9 additions and 5 deletions

View File

@ -35,6 +35,7 @@ getLogger("requests").setLevel(INFO)
getLogger("urllib3").setLevel(INFO)
getLogger("pyrogram").setLevel(ERROR)
getLogger("httpx").setLevel(ERROR)
getLogger("pymongo").setLevel(ERROR)
botStartTime = time()

View File

@ -937,11 +937,11 @@ def gofile(url):
"Accept": "*/*",
"Connection": "keep-alive",
}
__url = f"https://api.gofile.io/accounts"
__url = "https://api.gofile.io/accounts"
try:
__res = session.post(__url, headers=headers).json()
if __res["status"] != "ok":
raise DirectDownloadLinkException(f"ERROR: Failed to get token.")
raise DirectDownloadLinkException("ERROR: Failed to get token.")
return __res["data"]["token"]
except Exception as e:
raise e

View File

@ -120,12 +120,11 @@ async def add_jd_download(listener, path):
elif odl := await retry_function(
jdownloader.device.linkgrabber.query_packages, [{}]
):
odl_list = [
if odl_list := [
od["uuid"]
for od in odl
if od.get("saveTo", "").startswith("/root/Downloads/")
]
if odl_list:
]:
await retry_function(
jdownloader.device.linkgrabber.remove_links,
package_ids=odl_list,

View File

@ -6,12 +6,16 @@ from logging import (
basicConfig,
error as log_error,
info as log_info,
getLogger,
ERROR,
)
from os import path, environ, remove
from pymongo.mongo_client import MongoClient
from pymongo.server_api import ServerApi
from subprocess import run as srun
getLogger("pymongo").setLevel(ERROR)
if path.exists("log.txt"):
with open("log.txt", "r+") as f:
f.truncate(0)