From e07e9fb45982342a3bc77630b9e84fb1eebcf59a Mon Sep 17 00:00:00 2001 From: friendly Friend Date: Wed, 26 Jul 2023 08:22:58 +0200 Subject: [PATCH] -fixed ssl error. -more transparent error codes --- immich_exporter/exporter.py | 16 ++++++++++------ setup.py | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/immich_exporter/exporter.py b/immich_exporter/exporter.py index 9426ffc..2af4970 100644 --- a/immich_exporter/exporter.py +++ b/immich_exporter/exporter.py @@ -234,7 +234,6 @@ class ImmichMetricsCollector: continue break - logger.info(f"immich is up and running.") server_version_number = (str(response_server_version.json()["major"]) + "." + str(response_server_version.json()["minor"]) + "." + str(response_server_version.json()["patch"]) @@ -318,25 +317,30 @@ def check_server_up(immichHost, immichPort): continue break logger.info(f"Found immich up and running at " + immichHost + ":" + immichPort + ".") - time.sleep(5) + logger.info(f"Attempting to connect") + time.sleep(1) + logger.info(".") + def check_immich_api_key(immichHost, immichPort, immichApiKey): while True: try: - response_server_version = requests.request( + requests.request( "GET", - "https://"+immichHost+":"+immichPort+"/api/server-info/version", + "http://"+immichHost+":"+immichPort+"/api/server-info/", headers={'Accept': 'application/json', "x-api-key": immichApiKey} ) except requests.exceptions.RequestException as e: - logger.error(f"CONNECTION ERROR. Is the api key correct? You may have to delete the entry and copypaste it anew.") + logger.error(f"CONNECTION ERROR. Possible API key error") + logger.error({e}) time.sleep(3) continue + logger.info(f"Connected to immich successfully") break - logger.error(f"Immich API key matches") + def main(): # Init logger so it can be used diff --git a/setup.py b/setup.py index 5a1e948..c980f1c 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ with open("README.md", "r") as fh: setup( name='prometheus-immich-exporter', packages=['immich_exporter'], - version='1.0.4', + version='1.0.5', long_description=long_description, long_description_content_type="text/markdown", description='Prometheus exporter for immich',