Move initial JSON fetching into the expiration check function

It will avoid fetching it just to print the help

Signed-off-by: Alarig Le Lay <alarig@swordarmor.fr>
This commit is contained in:
Alarig Le Lay 2024-07-19 10:45:21 +02:00
parent 9ff18d29a8
commit d53d93c873
Signed by: alarig
GPG key ID: 7AFE62C6DF8BCDEC

View file

@ -15,6 +15,7 @@ import requests_cache
_log = logging.getLogger('nagiosplugin')
def expiration(domain):
list2dict = []
session = requests_cache.CachedSession(
@ -29,7 +30,6 @@ for list_of_list in req.json()['services']:
df = pandas.DataFrame(list2dict)
def expiration(domain):
domain = pyunycode.convert(domain)
tld = domain.split('.')[-1]
try: