mirror of
https://github.com/Balshgit/gpt_chat_bot.git
synced 2025-12-16 21:20:39 +03:00
add api exception handler (#74)
* try to add exception handler * improve server error test * fix lint * add build_uri util * fix header file path --------- Co-authored-by: Dmitry Afanasyev <afanasiev@litres.ru>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import os
|
||||
from datetime import datetime, timedelta
|
||||
from functools import cache, wraps
|
||||
from inspect import cleandoc
|
||||
@@ -39,3 +40,9 @@ def clean_doc(cls: Any) -> str | None:
|
||||
if cls.__doc__ is None:
|
||||
return None
|
||||
return cleandoc(cls.__doc__)
|
||||
|
||||
|
||||
def build_uri(uri_parts: list[str]) -> str:
|
||||
parts = [part.strip("/") for part in uri_parts]
|
||||
uri = str(os.path.join(*parts)).strip("/")
|
||||
return f"/{uri}"
|
||||
|
||||
Reference in New Issue
Block a user