I am writing a code to automatically change the backup Email for password recovery, but I can't find out the correct request, please help.
Камера: 10.223.70.56
Логин: admin
Новый email для сброса: your_reset_email@example.com
Запрос:
URL:
Ответ сервера:
HTTP Status: 400
Raw content: Error
Bad Request!
Проверка текущих настроек:
Error
Bad Request!
=== УСТАНОВКА EMAIL ДЛЯ СБРОСА ПАРОЛЯ ===get_camera_info.py
Камера: 10.223.70.56
Логин: admin
Новый email для сброса: your_reset_email@example.com
Запрос:
URL:
Ответ сервера:
HTTP Status: 400
Raw content: Error
Bad Request!
Проверка текущих настроек:
Error
Bad Request!
Python:
import requests
from requests.auth import HTTPDigestAuth
IP = "10.223.70.56"
USER = "admin"
PASS = "admin"
NEW_RESET_EMAIL = "your_reset_email@example.com" # Замените на реальный email
# URL для установки email восстановления пароля
RESET_EMAIL_URL = f"http://{IP}/cgi-bin/configManager.cgi?action=setConfig&PasswordReset.Email.Address={NEW_RESET_EMAIL}"
print("=== УСТАНОВКА EMAIL ДЛЯ СБРОСА ПАРОЛЯ ===")
print(f"Камера: {IP}")
print(f"Логин: {USER}")
print(f"Новый email для сброса: {NEW_RESET_EMAIL}\n")
try:
# Установка email
response = requests.get(RESET_EMAIL_URL,
auth=HTTPDigestAuth(USER, PASS),
timeout=5)
print("Запрос:")
print(f"URL: {RESET_EMAIL_URL}")
print("\nОтвет сервера:")
print(f"HTTP Status: {response.status_code}")
print(f"Raw content: {response.text}")
# Проверка
CHECK_URL = f"http://{IP}/cgi-bin/configManager.cgi?action=getConfig&name=PasswordReset"
check_response = requests.get(CHECK_URL,
auth=HTTPDigestAuth(USER, PASS),
timeout=5)
print("\nПроверка текущих настроек:")
print(check_response.text)
except Exception as e:
print(f"Ошибка: {str(e)}")