#!/usr/bin/env python3
import requests
from bs4 import BeautifulSoup
import re

BASE = 'https://sistema.skeenmx.app'
USERNAME = 'JoseSkeen'
PASSWORD = 'SKr#902_88'

session = requests.Session()
r = session.get(f'{BASE}/login', timeout=30)
soup = BeautifulSoup(r.text, 'html.parser')
token = soup.find('input', {'name': '_token'})
token = token['value'] if token else ''

session.post(f'{BASE}/login', data={
    '_token': token,
    'username': USERNAME,
    'password': PASSWORD,
}, timeout=30, allow_redirects=True)

r = session.get(f'{BASE}/expediente/ver/1', timeout=30)
text = r.text

# Encontrar todas las etiquetas de formulario
for m in re.finditer(r'<label[^>]*>(.*?)</label>', text, re.S):
    label = re.sub(r'<[^>]+>', '', m.group(1)).strip()
    if label:
        print(f'LABEL: {label}')
