first_commit

This commit is contained in:
2024-12-13 19:49:04 +03:00
commit 00cc47785e
23 changed files with 188 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
from pathlib import Path
DEFAULT_HEADERS = {
"Accept": "application/json",
"Authorization": "OAuth {token}",
}
def generate_headers(token: str) -> dict:
headers = DEFAULT_HEADERS.copy()
headers["Authorization"] = f"OAuth {token}"
return headers
def parse_path(path: str) -> str:
if path.startswith("/"):
path = "disk:/" + path[1:]
elif not path.startswith("disk:/"):
path = "disk:/" + path
path = Path(path) # Some kind of check is path valid or not =P
return str(path)