updated icon

This commit is contained in:
friendly Friend 2023-03-16 02:44:05 -07:00
parent 9a6558509b
commit 22438c0558
2 changed files with 20 additions and 2 deletions

View file

@ -49,7 +49,7 @@ class ImmichMetricsCollector:
def get_immich_users_stat_growth(self):
global response_user_stats
try:
endpoint_user_stats = "/api/server-info/stats"
response_user_stats = requests.request(
@ -102,10 +102,28 @@ class ImmichMetricsCollector:
@property
def get_immich_users_stat(self):
global response_user_stats
try:
endpoint_user_stats = "/api/server-info/stats"
response_user_stats = requests.request(
"GET",
self.combine_url(endpoint_user_stats),
headers={'Accept': 'application/json',
"x-api-key": self.config["token"]}
)
except requests.exceptions.RequestException as e:
logger.error(f"Couldn't get server version: {e}")
metrics = []
# To get the user count an api-endpoint exists but this works too. As a result one less api call is being made
userCount = len(response_user_stats.json()["usageByUser"])
try:
userCount = len(response_user_stats.json()["usageByUser"])
except Exception:
logger.error("Is the Immich api token valid? Traceback:KeyError: 'usageByUser': ")
# json array of all users with stats
# this line throws an error if api token is wrong. if the token is wrong or inavlid this will return a KeyError : 'usage by user'
userData = response_user_stats.json()["usageByUser"]
for x in range(0, userCount):

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 38 KiB