Sanitising a bit the date parsing in case there are spaces

Signed-off-by: Alarig Le Lay <alarig@swordarmor.fr>
This commit is contained in:
Alarig Le Lay 2024-07-27 14:43:42 +02:00
parent 2b112d5344
commit 559cb97cd4
Signed by: alarig
GPG key ID: 7AFE62C6DF8BCDEC

View file

@ -97,7 +97,8 @@ def parse_ldap(domain, rdap_server):
raw_expiration.append(line[3]) raw_expiration.append(line[3])
elif len(raw_expiration) == 1: elif len(raw_expiration) == 1:
fecha = raw_expiration[0].split('T')[0] fecha = raw_expiration[0].split('T')[0].strip().split()
fecha = fecha[0]
today = datetime.datetime.now() today = datetime.datetime.now()
delta = datetime.datetime.strptime(fecha, '%Y-%m-%d') - today delta = datetime.datetime.strptime(fecha, '%Y-%m-%d') - today
raw_expiration[0] = delta.days raw_expiration[0] = delta.days