mirror of
https://github.com/DerrtSML/qbittorent_bot.git
synced 2025-10-25 20:10:08 +03:00
Update bot.py
This commit is contained in:
parent
edfbe9f81b
commit
309297cc34
15
bot.py
15
bot.py
@ -44,8 +44,19 @@ def init_qbittorrent_client():
|
||||
logger.error("QBittorrent credentials are not fully set in environment variables.")
|
||||
return False
|
||||
try:
|
||||
qb = Client(f"http://{QBT_HOST}:{QBT_PORT}/")
|
||||
qb.login(QBT_USERNAME, QBT_PASSWORD)
|
||||
# --- ИЗМЕНИТЕ ЭТИ СТРОКИ ---
|
||||
# Передайте учетные данные прямо в конструктор Client
|
||||
# Используйте 'host' вместо 'f"http://{QBT_HOST}:{QBT_PORT}/"'
|
||||
# qbittorrentapi ожидает хост без 'http://' и без порта
|
||||
qb = Client(
|
||||
host=f"{QBT_HOST}:{QBT_PORT}", # Хост и порт вместе
|
||||
username=QBT_USERNAME,
|
||||
password=QBT_PASSWORD
|
||||
)
|
||||
# Проверим подключение, вызвав что-нибудь простое, например, api_version
|
||||
# Это также выполняет аутентификацию
|
||||
qb.app.api_version # Просто обращение к любому атрибуту qbittorrentapi, чтобы проверить соединение
|
||||
|
||||
logger.info(f"Successfully connected to qBittorrent at {QBT_HOST}:{QBT_PORT}")
|
||||
return True
|
||||
except APIError as e:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user