Corp/backend/TEST.py
Игорь Надеин 6fb2cdcea0 feat: enhance Employee model and integrate Telegram/WhatsApp bot
- Add birth_date, created_at/updated_at to Employee; remove username field
- Introduce EmployeeAction for tracking HR events and is_actually_active/status properties
- Create BotSubscriber model (OneToOne relation) for TG/WA binding
- Implement Aiogram-based Telegram bot:
  • request contact to bind by phone or @username
  • department selection keyboard from DEPARTMENTS dict
  • async ORM via sync_to_async, custom filters for bound & active employees
- Update profile view & template:
  • show “Bind Telegram/WhatsApp” button only when not already bound
  • preview avatar on upload
- Remove registration tokens in favor of contact-based auth
- Clean up templates, forms and add avatar validation mixin
2025-07-30 08:15:53 +03:00

29 lines
734 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import requests
# Задай свои значения:
app_key = 'admin'
app_secret = 'Baguvix26'
base_url = 'http://127.0.0.1:8208'
# В Hikvision OpenAPI по умолчанию
url = f'{base_url}/artemis/api/artemis/v1/agreementService/token/get'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
}
data = {
'appKey': app_key,
'appSecret': app_secret,
}
# Для некоторых систем нужен verify=False (если self-signed сертификат)
response = requests.post(url, json=data, headers=headers, verify=False)
if response.status_code == 200:
print('Ответ:', response.json())
else:
print('Ошибка:', response.status_code, response.text)