This commit is contained in:
+10
-4
@@ -187,10 +187,16 @@ class Server:
|
||||
url, headers=headers, json=new_item, timeout=self.timeout
|
||||
)
|
||||
log.info(f"Status: {create.status_code}")
|
||||
if create.status_code == 404:
|
||||
raise EndPointNotAvailableException
|
||||
if create.status_code == 409:
|
||||
log.fatal("Create Exception %s", create.json())
|
||||
match create.status_code:
|
||||
case 404:
|
||||
log.info("Endpoint %s not available", url)
|
||||
raise EndPointNotAvailableException
|
||||
case 405:
|
||||
log.info("POST request %s returned 405", url)
|
||||
case 409:
|
||||
log.fatal("Create Exception %s", create.json())
|
||||
case _:
|
||||
log.info("")
|
||||
data = create.json()
|
||||
return data
|
||||
|
||||
|
||||
@@ -139,6 +139,8 @@ def item_delete(table_name: str, item_id: str, api_data: Dict[str, Any], log: Lo
|
||||
url = f"http://{host}:{port}/api/media/actorfiles/{item_id}"
|
||||
case "media_actor":
|
||||
url = f"http://{host}:{port}/api/media/actors/{item_id}"
|
||||
case "media_lofi":
|
||||
url = f"http://{host}:{port}/api/media/lofi/{item_id}"
|
||||
case "profile":
|
||||
url = f"http://{host}:{port}/api/user/profile/{item_id}"
|
||||
headers: Dict[str, str] = {"Authorization": f"Bearer {token}"}
|
||||
@@ -209,6 +211,13 @@ if __name__ == "__main__":
|
||||
api_data=api_data,
|
||||
log=logger
|
||||
)
|
||||
case "media_lofi":
|
||||
item_delete(
|
||||
table_name=tablename,
|
||||
item_id=item_id,
|
||||
api_data=api_data,
|
||||
log=logger
|
||||
)
|
||||
case _:
|
||||
logger.info("Method to remove remaining item not implemented")
|
||||
logger.info("kontor.import finished")
|
||||
|
||||
Reference in New Issue
Block a user