- 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
29 lines
734 B
Python
29 lines
734 B
Python
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)
|