File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -1448,7 +1448,19 @@ def get_item_metrics(self, item):
14481448
14491449 url = f"{ self .API_ENDPOINT } /core/items/{ item .uuid } /metrics"
14501450 try :
1451- return self .api_get (url , None , None )
1451+ response = self .api_get (url )
1452+ if response .status_code == 200 :
1453+ return response .json ()
1454+ elif response .status_code == 401 :
1455+ logging .error (f"Unauthorized access for item { item .uuid } " )
1456+ elif response .status_code == 403 :
1457+ logging .error (f"Forbidden access for item { item .uuid } " )
1458+ elif response .status_code == 404 :
1459+ logging .error (f"Item or metrics not found for item { item .uuid } " )
1460+ else :
1461+ logging .error (
1462+ f"Unexpected response for item { item .uuid } : { response .status_code } "
1463+ )
14521464 except Exception as e :
14531465 logging .error (f"Error retrieving metrics for item { item .uuid } : { e } " )
14541466 return None
@@ -1477,7 +1489,9 @@ def get_item_thumbnail(self, item):
14771489 elif response .status_code == 404 :
14781490 logging .error (f"Item or thumbnail not found for item { item .uuid } " )
14791491 else :
1480- logging .error (f"Unexpected response for item { item .uuid } : { response .status_code } " )
1492+ logging .error (
1493+ f"Unexpected response for item { item .uuid } : { response .status_code } "
1494+ )
14811495 return None
14821496 except Exception as e :
14831497 logging .error (f"Error retrieving thumbnail for item { item .uuid } : { e } " )
You can’t perform that action at this time.
0 commit comments