Authorization with a token from the Personal Account (Access section)
#!/usr/bin/env python3
"""
Option 2: Authentication using a token from the Personal Account (Access section).
The token is passed in the request body as the "token" field.
"""
import requests
import json
# ===== SETTINGS =====
PROCESS_URL = "https://api.neuro-vision.ru/v1/kyc/process"
# Token from the Personal Account (Access section)
LK_TOKEN = "your-token-from-lk" # <!-- insert token from the Personal Account (Access section) -->
SCHEMA_ID = "your-schema-id" # <!-- substitute schemaId from the personal account -->
IMAGE_PATH = "path/to/your/image.jpg" # <!-- path to image
TIMEOUT = (30, 120)
# --- Sending image with token in the body ---
print(f"Отправляем {IMAGE_PATH}...")
data = {
"token": LK_TOKEN,
"schemaId": SCHEMA_ID,
"mode": "sync",
}
with open(IMAGE_PATH, "rb") as f:
files = [("images", (IMAGE_PATH.split("/")[-1], f, "image/jpeg"))]
resp = requests.post(
PROCESS_URL,
data=data,
files=files,
timeout=TIMEOUT,
)
print(f"Status: {resp.status_code}")
try:
print(json.dumps(resp.json(), ensure_ascii=False, indent=2))
except Exception:
print(resp.text)