Adding timeout to fetch the IANA RDAP JSON, just in case

Signed-off-by: Alarig Le Lay <alelay@scaleway.com>
This commit is contained in:
Alarig Le Lay 2024-07-19 12:04:13 +02:00
parent de5a36c380
commit cb96bb23be
No known key found for this signature in database
GPG key ID: 948D6BC249D8EBFF

View file

@ -22,7 +22,7 @@ def expiration(domain):
'/tmp/iana_rdap_cache',
cache_control=True
)
req = session.get('https://data.iana.org/rdap/dns.json')
req = session.get('https://data.iana.org/rdap/dns.json', timeout=120)
for k,v in req.json()['services']:
for x in k:
list2dict.append({'name':x, 'url':v[0]})
@ -58,7 +58,7 @@ def expiration(domain):
)
case _:
pass
_log.debug(f'The used RDAP JSON is {req_rdap.json()}')
raw_expiration = [
@ -76,7 +76,7 @@ def expiration(domain):
today = datetime.datetime.now()
delta = datetime.datetime.strptime(fecha, '%Y-%m-%d') - today
return(delta.days)
return delta.days
# data acquisition